k8s mac安装

https://zhuanlan.zhihu.com/p/65559363

安装后状态

➜  ~ kubectl cluster-info           
Kubernetes master is running at https://kubernetes.docker.internal:6443
KubeDNS is running at https://kubernetes.docker.internal:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
➜  ~ kubectl get namespaces         
NAME              STATUS   AGE
default           Active   42m
docker            Active   41m
kube-node-lease   Active   43m
kube-public       Active   43m
kube-system       Active   43m
➜  ~ kubectl get pods -n kube-system
NAME                                     READY   STATUS    RESTARTS   AGE
coredns-6dcc67dcbc-bhsql                 1/1     Running   0          42m
coredns-6dcc67dcbc-pllzh                 1/1     Running   0          42m
etcd-docker-desktop                      1/1     Running   0          41m
kube-apiserver-docker-desktop            1/1     Running   0          42m
kube-controller-manager-docker-desktop   1/1     Running   0          42m
kube-proxy-h7nn7                         1/1     Running   0          42m
kube-scheduler-docker-desktop            1/1     Running   0          42m

安装Dashboard

https://github.com/kubernetes/dashboard

安装

➜  ~ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-rc5/aio/deploy/recommended.yaml
namespace/kubernetes-dashboard created
serviceaccount/kubernetes-dashboard created
service/kubernetes-dashboard created
secret/kubernetes-dashboard-certs created
secret/kubernetes-dashboard-csrf created
secret/kubernetes-dashboard-key-holder created
configmap/kubernetes-dashboard-settings created
role.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrole.rbac.authorization.k8s.io/kubernetes-dashboard created
rolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
clusterrolebinding.rbac.authorization.k8s.io/kubernetes-dashboard created
deployment.apps/kubernetes-dashboard created
service/dashboard-metrics-scraper created
deployment.apps/dashboard-metrics-scraper created
➜  ~ kubectl get namespaces         
NAME                   STATUS   AGE
default                Active   46m
docker                 Active   45m
kube-node-lease        Active   46m
kube-public            Active   46m
kube-system            Active   46m
kubernetes-dashboard   Active   100s
➜  ~ kubectl get pods -n kubernetes-dashboard 
NAME                                         READY   STATUS    RESTARTS   AGE
dashboard-metrics-scraper-6f7544dfb7-p6kmx   1/1     Running   0          2m6s
kubernetes-dashboard-d6787d759-f4cfs         1/1     Running   0          2m6s
➜  ~ kubectl get deployment -n kubernetes-dashboard
NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
dashboard-metrics-scraper   1/1     1            1           11m
kubernetes-dashboard        1/1     1            1           11m

启动与访问

➜  ~ kubectl describe -n kube-system secret replication-controller-token-jcxmv
Name:         replication-controller-token-jcxmv
Namespace:    kube-system
Labels:       
Annotations:  kubernetes.io/service-account.name: replication-controller
              kubernetes.io/service-account.uid: 5879f108-579c-11ea-bd2a-025000000001

Type:  kubernetes.io/service-account-token

Data
====
ca.crt:     1025 bytes
namespace:  11 bytes
token:      eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJyZXBsaWNhdGlvbi1jb250cm9sbGVyLXRva2VuLWpjeG12Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQubmFtZSI6InJlcGxpY2F0aW9uLWNvbnRyb2xsZXIiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC51aWQiOiI1ODc5ZjEwOC01NzljLTExZWEtYmQyYS0wMjUwMDAwMDAwMDEiLCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06cmVwbGljYXRpb24tY29udHJvbGxlciJ9.bTl0vzgJ9k4AuZ8ryAbyawXjeOIvKB3yM1KkehEhgR9FrWYcwQkbXSW7WNK1ANlq_0cObMKTerGzela5p4hOL6kIaB8jOgw_l0HR6JNhwmT6j1CTqO6XQuVld3RmqnWrxPYQolr54P0GavteeTdSnOZOWsNwqY-xX8d_kXgXeOiKuEtWcyQsblVmvKF75jIGVojViIUjUssYoWeskR4L_Ek4XngC4hsy8erVukt4k5JImScgtjUA9y6jKqMuSFK35KOu6urVApH7O9xT2eJYCfJ5ty-jfD5d834i4-JVurIfTbcgwDyTIOSRKOuSrZ73xHYlQzBPeBZsGimj0qdrgg
➜  ~ kubectl proxy                                                            
Starting to serve on 127.0.0.1:8001

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login
选择token方式登录,输入上面的一长串token

你可能感兴趣的:(k8s mac安装)