学习阿良老师的视频总结 https://ke.qq.com/course/366778
一、kubectl工具
1、kubectl管理应用程序生命周期
# 创建
kubectl run nginx --replicas=3 --image=nginx:1.14 --port=80
kubectl get deploy,pods
# 发布
kubectl expose deployment nginx --port=80 --type=NodePort --target-port=80 --name=nginx-service
kubectl get service
# 更新nginx版本
kubectl set image deployment/nginx nginx=nginx:1.15
# 回滚
kubectl rollout history deployment/nginx
kubectl rollout undo deployment/nginx
# 删除
kubectl delete deploy/nginx
kubectl delete svc/nginx-service
2、kubectl 远程连接k8s
在master中的k8s-cert文件夹中,生成admin证书相关文件
cat > admin-csr.json <<EOF
{
"CN": "admin",
"hosts": [],
"key": {
"algo": "rsa",
"size": 2048
},
"names