swapon -s
sudo snap install microk8s --classic --edge
sudo usermod -a -G microk8s ye;
sudo chown -f -R ye ~/.kube;
exit
microk8s.start
microk8s.status
microk8s.kubectl get all --all-namespaces
microk8s.inspect
microk8s.config
microk8s.stop
microk8s.start
microk8s.enable dashboard dns
microk8s.kubectl get all --all-namespaces |
swapon -s
sudo snap install microk8s --classic --edge
sudo usermod -a -G microk8s ye;
sudo chown -f -R ye ~/.kube;
exit
microk8s.start
microk8s.status
microk8s.kubectl get all --all-namespaces
microk8s.inspect
microk8s.config
microk8s.stop
microk8s.start
microk8s.enable dashboard dns
microk8s.kubectl get all --all-namespaces
ye@ubuntu:~$ watch microk8s.kubectl get all --all-namespaces
Every 2.0s: microk8s.kubectl get all --all-namespaces ubuntu: Wed Apr 8 21:11:39 2020
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system pod/coredns-588fd544bf-mwwjg 1/1 Running 1 22m
kube-system pod/dashboard-metrics-scraper-db65b9c6f-tdpms 1/1 Running 1 22m
kube-system pod/heapster-v1.5.2-58fdbb6f4d-cfddq 4/4 Running 2 22m
kube-system pod/kubernetes-dashboard-67765b55f5-f5g2s 1/1 Running 1 22m
kube-system pod/monitoring-influxdb-grafana-v4-6dc675bf8c-bjfn5 2/2 Running 1 22m
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 61m
kube-system service/dashboard-metrics-scraper ClusterIP 10.152.183.61 <none> 8000/TCP 22m
kube-system service/heapster ClusterIP 10.152.183.225 <none> 80/TCP 22m
kube-system service/kube-dns ClusterIP 10.152.183.10 <none> 53/UDP,53/TCP,9153/TCP 22m
kube-system service/kubernetes-dashboard ClusterIP 10.152.183.21 <none> 443/TCP 22m
kube-system service/monitoring-grafana ClusterIP 10.152.183.218 <none> 80/TCP 22m
kube-system service/monitoring-influxdb ClusterIP 10.152.183.57 <none> 8083/TCP,8086/TCP 22m
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system deployment.apps/coredns 1/1 1 1 22m
kube-system deployment.apps/dashboard-metrics-scraper 1/1 1 1 22m
kube-system deployment.apps/heapster-v1.5.2 1/1 1 1 22m
kube-system deployment.apps/kubernetes-dashboard 1/1 1 1 22m
kube-system deployment.apps/monitoring-influxdb-grafana-v4 1/1 1 1 22m
NAMESPACE NAME DESIRED CURRENT READY AGE
kube-system replicaset.apps/coredns-588fd544bf 1 1 1 22m
kube-system replicaset.apps/dashboard-metrics-scraper-db65b9c6f 1 1 1 22m
kube-system replicaset.apps/heapster-v1.5.2-58fdbb6f4d 1 1 1 22m
kube-system replicaset.apps/kubernetes-dashboard-67765b55f5 1 1 1 22m
kube-system replicaset.apps/monitoring-influxdb-grafana-v4-6dc675bf8c 1 1 1 22m |
ye@ubuntu:~$ watch microk8s.kubectl get all --all-namespaces
Every 2.0s: microk8s.kubectl get all --all-namespaces ubuntu: Wed Apr 8 21:11:39 2020
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system pod/coredns-588fd544bf-mwwjg 1/1 Running 1 22m
kube-system pod/dashboard-metrics-scraper-db65b9c6f-tdpms 1/1 Running 1 22m
kube-system pod/heapster-v1.5.2-58fdbb6f4d-cfddq 4/4 Running 2 22m
kube-system pod/kubernetes-dashboard-67765b55f5-f5g2s 1/1 Running 1 22m
kube-system pod/monitoring-influxdb-grafana-v4-6dc675bf8c-bjfn5 2/2 Running 1 22m
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 61m
kube-system service/dashboard-metrics-scraper ClusterIP 10.152.183.61 <none> 8000/TCP 22m
kube-system service/heapster ClusterIP 10.152.183.225 <none> 80/TCP 22m
kube-system service/kube-dns ClusterIP 10.152.183.10 <none> 53/UDP,53/TCP,9153/TCP 22m
kube-system service/kubernetes-dashboard ClusterIP 10.152.183.21 <none> 443/TCP 22m
kube-system service/monitoring-grafana ClusterIP 10.152.183.218 <none> 80/TCP 22m
kube-system service/monitoring-influxdb ClusterIP 10.152.183.57 <none> 8083/TCP,8086/TCP 22m
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system deployment.apps/coredns 1/1 1 1 22m
kube-system deployment.apps/dashboard-metrics-scraper 1/1 1 1 22m
kube-system deployment.apps/heapster-v1.5.2 1/1 1 1 22m
kube-system deployment.apps/kubernetes-dashboard 1/1 1 1 22m
kube-system deployment.apps/monitoring-influxdb-grafana-v4 1/1 1 1 22m
NAMESPACE NAME DESIRED CURRENT READY AGE
kube-system replicaset.apps/coredns-588fd544bf 1 1 1 22m
kube-system replicaset.apps/dashboard-metrics-scraper-db65b9c6f 1 1 1 22m
kube-system replicaset.apps/heapster-v1.5.2-58fdbb6f4d 1 1 1 22m
kube-system replicaset.apps/kubernetes-dashboard-67765b55f5 1 1 1 22m
kube-system replicaset.apps/monitoring-influxdb-grafana-v4-6dc675bf8c 1 1 1 22m
ye@ubuntu:~$ token=$(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)
ye@ubuntu:~$ microk8s kubectl -n kube-system describe secret $token
Name: default-token-ztf7s
Namespace: kube-system
Labels: <none>
Annotations: kubernetes.io/service-account.name: default
kubernetes.io/service-account.uid: 4cebf31a-454d-4eb2-aa53-15e3082267cf
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1103 bytes
namespace: 11 bytes
token: eyJhbGciO...EolgcJnAnVrdQ |
ye@ubuntu:~$ token=$(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)
ye@ubuntu:~$ microk8s kubectl -n kube-system describe secret $token
Name: default-token-ztf7s
Namespace: kube-system
Labels: <none>
Annotations: kubernetes.io/service-account.name: default
kubernetes.io/service-account.uid: 4cebf31a-454d-4eb2-aa53-15e3082267cf
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1103 bytes
namespace: 11 bytes
token: eyJhbGciO...EolgcJnAnVrdQ
microk8s.kubectl proxy
Starting to serve on 127.0.0.1:8001
C:\Users\ye>ssh -L localhost:8001:localhost:8001 -NT ye@192.168.8.120
K8S dashboard v2
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
K8S dashboard v1
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/ |
microk8s.kubectl proxy
Starting to serve on 127.0.0.1:8001
C:\Users\ye>ssh -L localhost:8001:localhost:8001 -NT [email protected]
K8S dashboard v2
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
K8S dashboard v1
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
Kubernetes Cheat Sheet
Docker Cheat Sheet
Related Posts