Deploy an app
$ microk8s kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1
deployment.apps/kubernetes-bootcamp created
$ microk8s kubectl get pods
NAME READY STATUS RESTARTS AGE
kubernetes-bootcamp-6f6656d949-7bhlv 1/1 Running 0 6m44s
$ microk8s kubectl logs kubernetes-bootcamp-6f6656d949-7bhlv
Kubernetes Bootcamp App Started At: 2020-04-11T06:37:09.171Z | Running On: kubernetes-bootcamp-6f6656d949-7bhlv
再用一个docker nginx 官方的镜像作为例子
$ kubectl create deployment nginx --image=nginx
deployment.apps/nginx created
$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
kubernetes-bootcamp 1/1 1 1 67m
nginx 1/1 1 1 4s
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
kubernetes-bootcamp-6f6656d949-7bhlv 1/1 Running 0 67m
nginx-f89759699-gd2fq 1/1 Running 0 10s
[root@hello-staging ~]# kubectl get all --all-namespaces |grep nginx
default pod/nginx-f89759699-gd2fq 1/1 Running 0 36s
default deployment.apps/nginx 1/1 1 1 36s
default replicaset.apps/nginx-f89759699 1 1 1 36s
网友评论