2017-08-01 114 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