首页 > 解决方案 > Kubernetes 在版本“extensions/v1beta1”中没有匹配类型“部署”

问题描述

我正在尝试使用 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"

如果我kubectl apply -f IKonnekt/frontend-deployment.yaml从 Kubernetes 集群内的机器运行,它工作正常。

Kubernetes Client Version: 1.12.1
Kubernetes Server Version: 1.11.0

这是我的前端部署.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

标签: jenkinskuberneteskubectl

解决方案


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


推荐阅读