2017-08-01 31 views
1

我运行1.6.2,和我打了/apis/batch/v2alpha1/namespaces/<namespace>/cronjobs端点,一个有效的命名空间和未找到资源创建的cronjob

{ 
    "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 
} 

根据文档,该端点应该存在。我想我可能有一些设置不正确,但我不确定哪一个以及如何纠正它。任何帮助表示赞赏。

回答

1

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