k8s 命令使用练习
kubectl create deployment mydeply1 --image nginx kubectl create deployment mydeply2 --replicas 3 --image nginx kubectl scale deployment mydeply1 --replicas 3 [root@k8s-master yaml]# kubectl get pod NAME READY STATUS RESTARTS AGE mydeply1-6f5487cd5c-2r5x5 1/1 Running 0 107s mydeply1-6f5487cd5c-jph7k 1/1 Running 0 107s mydeply1-6f5487cd5c-p2tz4 1/1 Running 0 5m25s mydeply2-569799bbc8-b259h 1/1 Running 0 3m29s mydeply2-569799bbc8-k7c48 1/1 Running 0 3m29s mydeply2-569799bbc8-nkxj9 1/1 Running 0 3m29s kubectl exec -it mydeply1-6f5487cd5c-jph7k -- bash [root@k8s-master yaml]# kubectl exec -it mydeply1-6f5487cd5c-jph7k -- bash root@mydeply1-6f5487cd5c-jph7k:/# root@mydeply1-6f5487cd5c-jph7k:/# root@mydeply1-6f5487cd5c-jph7k:/# ls bin boot dev docker-entrypoint.d docker-entrypoint.sh etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var root@mydeply1-6f5487cd5c-jph7k:/# kubectl expose deployment mydeply2 --name svc-deply2 --port 8080 --target-port 80 --type NodePort