docker search nginx
[root@k8smaster ~]# docker search nginx
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
nginx Official build of Nginx. 16152 [OK]
查看docker images
是否安装
[root@k8smaster ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
rancher/mirrored-flannelcni-flannel v0.16.1 404fc3ab6749 2 weeks ago 69.9MB
registry.aliyuncs.com/google_containers/kube-apiserver v1.23.1 b6d7abedde39 4 weeks ago 135MB
registry.aliyuncs.com/google_containers/kube-proxy v1.23.1 b46c42588d51 4 weeks ago 112MB
registry.aliyuncs.com/google_containers/kube-controller-manager v1.23.1 f51846a4fd28 4 weeks ago 125MB
registry.aliyuncs.com/google_containers/kube-scheduler v1.23.1 71d575efe628 4 weeks ago 53.5MB
registry.aliyuncs.com/google_containers/etcd 3.5.1-0 25f8c7f3da61 2 months ago 293MB
rancher/mirrored-flannelcni-flannel-cni-plugin v1.0.0 cd5235cd7dc2 2 months ago 9.03MB
registry.aliyuncs.com/google_containers/coredns v1.8.6 a4ca41631cc7 3 months ago 46.8MB
registry.aliyuncs.com/google_containers/pause 3.6 6270bb605e12 4 months ago 683kB
现在没有,执行安装 kubectl create deployment nginx --image=nginx
[root@k8smaster ~]# kubectl create deployment nginx --image=nginx
deployment.apps/nginx created
查看状态kubectl get pod
[root@k8smaster ~]# kubectl get pod
NAME READY STATUS RESTARTS AGE
nginx-85b98978db-w87hr 1/1 Running 0 70s
查看service服务 kubectl get svc
[root@k8smaster ~]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.66.0.1 <none> 443/TCP 46h
nginx NodePort 10.66.32.86 <none> 80:31617/TCP 7m56s
80(容器内部端口访问):31617(外部端口)
容器编排 kubectl expose deployment nginx --port=80 --type=NodePort
浏览器打开:http://192.168.116.104:31617/
查看节点、服务、控制器、容器命令:
#查看node节点
kubectl get node(s)
#查看服务端口
kubectl get service(s)
#查看控制器
kubectl get deployment (deploy)
#查看pod容器有哪些docker
kubectl get pod(s)
kubectl命令帮助
kubectl --help
删除service
kubectl delete service nginx
删除nginx的控制器
kubectl delete deployment nginx
删除pod
kubectl delete pod nginx-85b98978db-w87hr
(pod名字)
网友评论