gpt4 book ai didi

kubernetes - 找不到用于创建CronJob的资源

转载 作者:行者123 更新时间:2023-12-02 12:22:26 24 4
gpt4 key购买 nike

我正在运行1.6.2,并命中了/apis/batch/v2alpha1/namespaces/<namespace>/cronjobs端点,带有有效的 namespace 和请求主体

{
"body": {
"apiVersion": "batch/v2alpha1",
"kind": "CronJob",
"metadata": {
"name": "hello"
},
"spec": {
"schedule": "*/1 * * * *",
"jobTemplate": {
"spec": {
"template": {
"spec": {
"containers": [
{
"name": "hello",
"image": "busybox",
"args": [
"/bin/sh",
"-c",
"date; echo Hello from the Kubernetes cluster"
]
}
],
"restartPolicy": "OnFailure"
}
}
}
}
}
}

}

我收到了回应
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "the server could not find the requested resource",
"reason": "NotFound",
"details": {},
"code": 404
}

根据文档,此端点应该存在。我认为我可能设置了一些错误的设置,但是我不确定哪个设置以及如何更正它。任何帮助表示赞赏。

最佳答案

默认情况下不启用v2alpha1功能。确保使用此开关启动kube-apiserver来启用CronJob资源:--runtime-config=batch/v2alpha1=true

关于kubernetes - 找不到用于创建CronJob的资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45427831/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com