相匹配的内容在版本

相匹配的内容在版本

本文介绍了Kubernetes没有与类型“部署"相匹配的内容在版本“扩展/v1beta1"中,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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"

如果我从Kubernetes集群中的计算机上运行kubectl apply -f IKonnekt/frontend-deployment.yaml,它将正常工作.

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

这是我的frontend-deployment.yaml:

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

推荐答案

我的问题是因为我在Jenkinsfile中使用的是Kubernetes仪表板URL,而不是Kubernetes API URL,因此Jenkins的kubectl无法识别kubernetes服务器.

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.

最后,使用API​​ URL并更新apiVersion,它对我有用.

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

这篇关于Kubernetes没有与类型“部署"相匹配的内容在版本“扩展/v1beta1"中,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 21:19