gpt4 book ai didi

kubernetes - Kubernetes为重启策略使用了错误的值

转载 作者:行者123 更新时间:2023-12-02 11:40:38 25 4
gpt4 key购买 nike

我正在尝试使用以下配置在kubernetes中进行Job部署,但出现此错误:

spec.template.spec.restartPolicy: Unsupported value: "Always": supported values: OnFailure, Never

就像kubernetes不会读取我的restartPolicy配置(设置为never)或在某个地方被覆盖...

“有趣”的事情是它适用于我的Cronjob部署(我对他们两个都使用相同的模板)。

Kubernetes版本:1.7.7

这是我的配置:
{
"apiVersion": "batch/v1",
"kind": "Job",
"metadata": {
"name": "pipeline-test",
"labels": {
"app": "pipeline-test",
"env": "test",
"commit": "xxxxxxxx"
},
"namespace": "pipeline-test"
},
"spec": {
"jobTemplate": {
"spec": {
"template": {
"metadata": {
"labels": {
"app": "pipeline-test",
"env": "test",
"commit": "xxxxxxxx"
}
},
"spec": {
"restartPolicy": "Never",
"containers": [
{
"name": "pipeline-test",
"image": "us.gcr.io/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"env": [
{
"name": "APP_ENV",
"value": "test"
},
{
"name": "MAX_WORKERS",
"value": "2"
},
{
"name": "TYPE_CASTING",
"value": "false"
},
{
"name": "ENV",
"value": "test"
},
{
"name": "PROJECT_NAME",
"value": "null-testing1-v"
},
{
"name": "JOB_NAME",
"value": "testjob"
},
{
"name": "SUBSCRIPTION_NAME",
"value": "testsub"
},
{
"name": "CACHE_INVALIDATOR",
"value": "14-1"
},
{
"name": "GIT_COMMIT",
"value": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
{
"name": "APP_GIT_COMMIT",
"value": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
},
{
"name": "APP_NAME",
"value": "pipeline-test"
},
],
"volumeMounts": [

],
"ports": [
{
"containerPort": 3000
}
],
"resources": {
"requests": {
"cpu": "100m",
"memory": "512Mi"
},
"limits": {
"cpu": "1000m",
"memory": "512Mi"
}
}
}
],
"volumes": [

],
"imagePullSecrets": [
{
"name": "image-pull-secret"
}
]
}
}
}
}
}
}

谢谢

编辑:我能够通过删除2行来运行它:
    "jobTemplate": {
"spec": {

因此,restartPolicy在json中处于错误的级别,因此无法读取。

最佳答案

我能够通过删除2行来运行它:

"jobTemplate": {
"spec": {

因此,restartPolicy在json中处于错误的级别,因此无法读取。

关于kubernetes - Kubernetes为重启策略使用了错误的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52044180/

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