Kubernetes cronjob需要设置批处理/v2alpha1 = true的运行时配置 [英] Kubernetes cronjob needs to set a runtime config of batch/v2alpha1=true

查看:384
本文介绍了Kubernetes cronjob需要设置批处理/v2alpha1 = true的运行时配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想运行演示时,出现错误:

When I want to run the demo, I get the error:

错误:验证"cronJob_example.yaml"时出错:验证数据时出错: 找不到类型:v2alpha1.CronJob;如果您选择忽略这些 错误,请使用--validate = false

error: error validating "cronJob_example.yaml": error validating data: couldn't find type: v2alpha1.CronJob; if you choose to ignore these errors, turn validation off with --validate=false

然后我发现:

先决条件您需要一个版本大于等于1.4的Kubernetes集群 (对于ScheduledJob),> = 1.5(对于CronJob),使用batch/v2alpha1 API 通过传递--runtime-config = batch/v2alpha1 = true来打开 启动API服务器(请参阅为您的API打开或关闭API版本) 集群以获取更多信息.

Prerequisites You need a working Kubernetes cluster at version >= 1.4 (for ScheduledJob), >= 1.5 (for CronJob), with batch/v2alpha1 API turned on by passing --runtime-config=batch/v2alpha1=true while bringing up the API server (see Turn on or off an API version for your cluster for more).

上述条件需要执行--runtime-config=batch/v2alpha1=true,但我不知道在哪里以及如何执行

The above conditions need to do --runtime-config=batch/v2alpha1=true, but I don't know where and how to execute it

推荐答案

此处已记录. https://kubernetes.io/docs/concepts/workloads/controllers/cron -jobs/我们需要在API服务器中启用此功能.

Here is it documented. https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/ we need to enable this feature in API server.

在主服务器上,您需要在此文件/etc/kubernetes/manifests/kube-apiserver.yaml中添加line命令部分.然后重新启动整个集群.

on the master server you need to add the line command section in this file /etc/kubernetes/manifests/kube-apiserver.yaml. then restart whole cluster.

重新启动后,请检查api版本.我们应该看到该功能已启用.

After restart check the api version. we should see the feature enabled.

kubectl api-versions |grep batch
batch/v1
batch/v2alpha1

这篇关于Kubernetes cronjob需要设置批处理/v2alpha1 = true的运行时配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆