Deployment资源实战
用于部署服务到k8s集群,支持滚动更新,灰度发布,蓝绿部署。底层采用的rs作为副本控制器。
deployment 相关命令
创建deployment
kubectl create deployment baimei-linux --image=harbor.baimei.com/baimei-apps/apps:v1
修改deployment
1)资源清单配置文件修改[交互式]
kubectl edit deployments baimei-linux
2)修改容器的镜像[非交互式]
kubectl set image deploy baimei-linux nginx=harbor.baimei.com/baimei-apps/apps:v1
删除deployment
kubectl delete deployment baimei-linux
查看 deployment
kubectl get deployment.apps
cat 01-deploy-nginx.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-nginx-v1
labels:
apps: myweb
spec:
replicas: 3
selector:
matchExpressions:
- key: apps
values:
- "v1"
- "v2"
operator: NotIn
template:
metadata:
labels:
# apps: v1
school: baimei
spec:
containers:
- name: v1
image: harbor.baimei.com/baimei-apps/apps:v1
#image: harbor.baimei.com/baimei-apps/apps:v2
---
apiVersion: v1
kind: Service
metadata:
name: deploy-v1
spec:
type: NodePort
selector:
# apps: v1
school: baimei
ports:
- port: 8888
targetPort: 80
nodePort: 40000
Deployment资源实战: 连接
使用deployment部署redis案例 : 连接
deloyment升级策略 : 连接
deployment实现蓝绿部署案例 : 连接
deployment实现灰度发布案例 : 连接
欢迎来撩 : 汇总all