使用Replicaset创建pods集群

1.创建yaml配置文件

apiVersion: apps/v1
kind: ReplicaSet
metadata:
  name: nginx
  labels:
    tier: frontend
spec:
  replicas: 3
  selector:
    matchLabels:
      tier: frontend
  template:
    metadata:
      name: nginx
      labels:
        tier: frontend
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80

2.创建

kubectl create -f re_nginx.yml

3.查看

kubectl get rs 查看replicatset

4.查看pods

kubectl get pods

5.扩展

通过kubectl scale rs nginx --replicat=2

猜你喜欢

转载自blog.csdn.net/yuxiang1014/article/details/85012081