Delpyment演示
启动minikube
minikube start
deployment_nginx.yml
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx spec: replicas: 3 selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.12.2 ports: - containerPort: 80
创建deployment
kubectl create -f deployment_nginx.ymlkubectl get deploymentkubectl get rskubectl get pods
deployment信息
可以看到这个deloyment下的详情,nginx是1.12.2
kubectl get deployment -o wide
deployment的升级
针对目前的nginx1.12升级成1.13的命令,老的下面自动移除了,全部都在新的下面。
kubectl set image deployment nginx-deployment nginx=nginx:1.13 kubectl get deployment kubectl get deployment -o wide kubectl get pods
deployment查看历史版本
kubectl rollout history deployment nginx-deployment
deployment 回滚到之前的版本
又变成了nginx 1.12.2
kubectl rollout undo deployment nginx-deployment
deployment 端口暴露
其实就是把端口暴露在minikube上。
kubectl get node kubectl get node -o wide kubectl expose deployment nginx-deployment --type=NodePort#查看node节点暴露的端口30960kubectl get svc#进入minikube查看ip地址192.168.99.100minikube ssh
image.png
PS:不管怎么样完成了服务的暴露,具体这个service是什么,暴露
作者:IT人故事会
链接:https://www.jianshu.com/p/5741effe6035