翻译为:标志—副本已弃用,没有效果,并将在未来被移除。
在执行Deployment命令时

[root@master ~]# kubectl run nginx --image=nginx:latest --port=80 --replicas=3 -n dev
Flag --replicas has been deprecated, has no effect and will be removed in the future.

会报这个错误。原因在于K8S v1.18.0以后,–replicas已弃用 ,推荐用 deployment 声明试对象创建 pod。
类如:vim deploy-nginx.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
  namespace: dev
spec:
  replicas: 3
  selector:
    matchLabels:
      run: nginx
  template:
    metadata:
      labels:
        run: nginx
    spec:
      containers:
      - image: nginx:latest
        name: nginx
        ports:
        - containerPort: 80
          protocol: TCP

创建:kubectl create -f deploy-nginx.yaml
删除:kubectl delete -f deploy-nginx.yaml

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐