(extensions/v1beta1) does not match the expected API version (apps/v1).

ERROR: ERROR: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://192.168.16.129:6443/apis/apps/v1/namespaces/jx/deployments. Message: the API version in the data (extensions/v1beta1) does not match the expected API version (apps/v1). Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=the API version in the data (extensions/v1beta1) does not match the expected API version (apps/v1), metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).
hudson.remoting.ProxyException: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://192.168.16.129:6443/apis/apps/v1/namespaces/jx/deployments. Message: the API version in the data (extensions/v1beta1) does not match the expected API version (apps/v1). Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=the API version in the data (extensions/v1beta1) does not match the expected API version (apps/v1), metadata=ListMeta(_continue=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).

Jenkins构建项目,报这个错是因为api接口版本与deploy的yaml版本不一致导致,解决方案如下

  • upgrade apiVersion of the deployment to apps/v1 升级Deployment的apiVersion至apps/v1

  • spec.selector must match .spec.template.metadata.labels in apps/v1  spec.selector必须与容器模板的labels匹配的上

参考官方:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80

 

转载于:https://my.oschina.net/u/1271447/blog/3084216

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值