Deployment
1.创建yml文件
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
2.创建
kubectl create -f xx.yml
3.查看
kubectl get deployment
4.滚动升级\回滚
kubectl set image deployment/nginx nginx=nginx:v2
kubectl rollout undo deployment/nginx
HPA
实现自动pod伸缩
kubectl autoscale deployment nginx --min=2 --max=6 --cpu-percent=80
horizontalpodautoscalers
kubectl get horizontalpodautoscalers
kubectl edit horizontalpodautoscalers nginx
5.删除
kubectl delete deployment ngxin
网友评论