我想参考https://docs.gitlab.com/ee/user/project/clusters/#adding-an-existing-kubernetes-cluster
在Gitlab的k8s集成中安装Helm。但是当我单击Helm Tiler的Install
按钮时,响应为401。
我的过程在下面。
API_URL
运行此$ kubectl cluster-info | grep 'Kubernetes master' | awk '/http/ {print $NF}'
https://xx.xxx.xx.xx // set this `API_URL`
$ kubectl create -f - <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab
namespace: default
EOF
$ kubectl create -f - <<EOF
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: gitlab-cluster-admin
subjects:
- kind: ServiceAccount
name: gitlab
namespace: default
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io
EOF
$ kubectl get secrets
default-token-xxxx kubernetes.io/service-account-token 3 25d
gitlab-token-xxxx kubernetes.io/service-account-token 3 21h
tls-sample kubernetes.io/tls 2 24d
所以,我选择gitlab-token-xxxx
。
CA Certificate
运行此$ kubectl get secret gitlab-token-xxxx -o jsonpath="{['data']['ca\.crt']}" | base64 --decode
-----BEGIN CERTIFICATE-----
MIIDDDCCAfSgAwIBAgIRAJ0S/Fsf1dDFRZP9TCnby60wDQYJKoZIhvcNAQELBQAw
......
.....
FZ1tsRI3EbTNuKsyKtvjwg==
-----END CERTIFICATE-----
我以此为CA Certificate
Token
运行此$ kubectl get secret <secret name> -o jsonpath="{['data']['token']}" | base64 --decode
eyJhbGciOi.........
我以此为Token
请教我正确的方法!
答案 0 :(得分:1)
谢谢您看到这个问题。
我通过以下方法安装了它,没有显示错误!非常感谢你!
kubectl create clusterrolebinding gitlab-internal-cluster-rule --clusterrole=cluster-admin --serviceaccount=gitlab-managed-apps:default