赞
踩
[root@m50 mnt]# kubectl cluster-info
Kubernetes control plane is running at https://192.168.10.50:6443
CoreDNS is running at https://192.168.10.50:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy .......
kubectl create ns gitlab
tee gitlab-sa.yaml<<-'EOF' --- apiVersion: v1 kind: ServiceAccount metadata: name: gitlab namespace: gitlab --- apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding metadata: name: gitlab namespace: gitlab subjects: - kind: ServiceAccount name: gitlab namespace: gitlab roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin EOF
kubectl apply -f gitlab-sa.yaml
kubectl get serviceaccount gitlab -n gitlab -o json | jq -r '.secrets[0].name'
gitlab-token-qhm94
kubectl get secret gitlab-token-qhm94 -n gitlab -o json | jq -r '.data["ca.crt"]' | base64 -d
kubectl get secret gitlab-token-qhm94 -n gitlab -o json | jq -r '.data.token' | base64 -d
stages:
deploy:
tags:
- k8s
image: rancher/kubectl:v1.23.3
stage: deploy
script:
- kubectl config set-context my-k8s --server=$K8S_URL --certificate-authority="$K8S_CA"
- kubectl config set-credentials gitlab-token-qhm94 --token="$KS8_TOKEN"
- kubectl get pods -n gitlab
`
kubectl config set-context my-k8s --server=$K8S_URL --certificate-authority="$K8S_CA"
kubectl config set-credentials gitlab-token-qhm94 --token="$KS8_TOKEN"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。