李明
|
不要直接使用和管理Pods,为什么?
Service
Service的演示
get pod kubectl get pod -o wide kubectl expose pods nginx #查看到已经创建的service kubectl get
ping 10.254.233.245 复制代码
cd deployk8s-master/ cd labs/ cd deployment/ more 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 kubectl create -f deployment_nginx.yml kubectl get pods -o wide
kubectl get deployment expose deployment nginx-deployment kubectl get svc 复制代码 service内部的修改部署kubectl edit deployment nginx-deployment 复制代码 PS:根据你修改的文件内容,它就自动更新了,但是ip没有发生改变,这就是service的强大。但是目前这种直接改deloyment文件的形式,不是推荐的因为他不是滚动更新,下次说下滚动更新。 |
2018-10-22 11:04:24