扩容名字为loadbalancer的deployment的副本数为6
loadbalancer.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: loadbalancer
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
kubectl create -f loadbalancer.yaml
kubectl scale --replicas=6 deploy loadbalancer
使用kubectl edit也可以
k8s学习-Deployment(模板、更新、扩缩容、回滚等)
k8s学习-kubectl命令常用选项详解与实战
更多k8s相关内容,请看文章:k8s学习-思维导图与学习笔记