Thank you for reading this post, don't forget to subscribe!
создать csv файл с логином и паролем
1 2 3 |
cat > /etc/kubernetes/users/known_users.csv<<EOF 123*Password*123,kube,admin,"system:masters" EOF |
в API /etc/kubernetes/manifests/kube-apiserver.yaml
добавить --basic-auth-file, volumeMounts и volumes
[codesyntax lang="php"]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
spec: containers: - command: - kube-apiserver - --basic-auth-file=/etc/kubernetes/users/known_users.csv volumeMounts: - mountPath: /etc/kubernetes/users name: basic-auth-config volumes: - hostPath: path: /etc/kubernetes/users type: "" name: basic-auth-config |
[/codesyntax]
в deployment dashboard добавить/изменить аргумент
--authentication-mode=token,basic
[codesyntax lang="php"]
1 2 3 4 5 6 7 8 9 10 11 12 13 |
spec: containers: - name: kubernetes-dashboard image: kubernetesui/dashboard:v2.0.0-beta4 imagePullPolicy: Always ports: - containerPort: 8443 protocol: TCP args: - --auto-generate-certificates - --namespace=kubernetes-dashboard - --authentication-mode=token,basic - --token-ttl=0 |
[/codesyntax]