我正在尝试使用Jenkins在Kubernetes中部署下一个frontend-deployment.yaml,但是出现下一个错误:

[frontend] Running shell script
+ kubectl apply -f IKonnekt/frontend-deployment.yaml
error: unable to recognize "IKonnekt/frontend-deployment.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"

如果我从Kubernetes集群中的机器上运行kubectl apply -f IKonnekt/frontend-deployment.yaml,它将运行良好。
Kubernetes Client Version: 1.12.1
Kubernetes Server Version: 1.11.0

这是我的frontend-deployment.yaml:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: ikonnekt-frontend-deployment
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: ikonnekt-frontend
    spec:
      containers:
      - name: ikonnekt-frontend
        image: ikonnektfrontend
        imagePullPolicy: Always
        env:
        - name: REACT_APP_API
          value: "http://IP:Port"
        - name: REACT_APP_AUTH_ENDPOINT
          value: "http://IP:Port/auth"
        ports:
        - containerPort: 80
      imagePullSecrets:
      - name: regcred

最佳答案

只需将 apiVersion 更改为此:apiVersion: apps/v1

09-10 23:10