1.error: unable to recognize "httpd.yml": no matches for kind "Deployment" in version "apps/v1beta1"

此错误是由于K8S版本原因,我使用的版本是1.23.5,此版本已经弃用apps/v1beta1

原配置

apiVersion: extensions/v1beta1
kind: Deployment

修改为

apiVersion: apps/v1
kind: Deployment

2.error: error validating "httpd.yml": error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec

缺少必备参数selector 

修改后配置如下

apiVersion: apps/v1
kind: Deployment
metadata:
  name: httpd
spec:
  replicas: 2
  selector:
    matchLabels:
      app: httpd
  template:
    metadata:
      labels:
        app: httpd
    spec:
      containers:
      - name: httpd
        image: httpd
        ports:
        - containerPort: 80

Logo

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

更多推荐