简体   繁体   中英

Kubernetes no matches for kind "Deployment" in version "extensions/v1beta1"

I am trying to deploy the next frontend-deployment.yaml in Kubernetes using Jenkins, but I am having the next error:

[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"

If I run kubectl apply -f IKonnekt/frontend-deployment.yaml from a machine inside the Kubernetes cluster it works fine.

Kubernetes Client Version: 1.12.1
Kubernetes Server Version: 1.11.0

This is my 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

My problem was because in the Jenkinsfile I was using the Kubernetes dashboard URL instead of the Kubernetes API URL, so the kubectl of Jenkins couldn't recognize the kubernetes server.

So finally, using the API URL and updating the apiVersion it works for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM