k8s 核心概念思维导图
集群搭建
https://www.kubernetes.org.cn/4387.html
入门操作
-
创建查看集群
kubectl get nodes -o wide # 查看集群节点信息 kubectl cluster-info # Display cluster info 显示集群信息
-
部署应用
kubectl run my-ngx --image=nginx:latest --port=80 # 部署应用
-
发布应用
kubectl expose deployment my-ngx --type='NodePort' --port=80 # 发布应用 kubectl get services/my-ngx # 查看my-ngx服务 kubectl describe services/my-ngx # 查看详细信息 curl 10.9.2.42:19999 # curl NodeIP:NodePort
-
扩容缩容
kubectl scale deployment/my-ngx --replicas=2 # 扩容 kubectl get pods -o wide kubectl scale deployment/my-ngx --replicas=1 # 缩容
-
更新回滚
kubectl set image deployment/my-ngx my-ngx=nginx:1.9 # 滚动更新 kubectl rollout undo deployment/my-ngx # 回滚
-
删除
kubectl get pods # 查看pods kubectl get deployment # 查看deployment服务 kubectl delete pods my-ngx-59497d7745-qzwqz # 删除pods kubectl delete deployment my-ngx # 删除deployment
参考
<<Kubenetes指南 倪鹏飞>>
https://www.kubernetes.org.cn/4387.html # 安装集群