Le dashboard de Kubernetes
Rédigé par dada / 04 novembre 2018 / 2 commentaires
Installer le Dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
dada@k8smaster:~$ kubectl get pods --all-namespaces -o wide | grep dashb
kube-system kubernetes-dashboard-77fd78f978-f8p9l 1/1 Running 0 60s 10.244.1.230 k8snode1 <none>
Créez un compte utilisateur
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: admin-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: admin-user
namespace: kube-system
kubectl apply -f admin-user.yaml
kubectl apply -f admin-role.yaml
Récupérer le token de connexion
dada@k8smaster:~$ kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')
Name: admin-user-token-b8qmq
Namespace: kube-system
Labels: <none>
Annotations: kubernetes.io/service-account.name: admin-user
kubernetes.io/service-account.uid: a8a600b1-e010-11e8-96ec-0800273c4560
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1025 bytes
namespace: 11 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJl.........
Accéder au Dashboard
Le proxy
dada@k8smaster:~$ kubectl proxy
Starting to serve on 127.0.0.1:8001
Le tunnel SSH
dada@dada-laptop:~$ ssh -L 8001:127.0.0.1:8001 dada@IP_DU_MASTER