0

i'm working with Kubernetes and Jenkins-x, i need to create a devpod with customized property. In particular i need a timeoutSeconds for the livenessProbe differebt from the default one. I dont know how to customize this attribute before the pod is created so i'm trying to update it once it's running. I tried with

kubectl edit pod/<pod_name>

but it told me i cant update that property.

Do you have suggestions on how i can do this?

Thank you.

4

2 回答 2

1

您可以使用 kubectl--overrides标志。类似的东西,

kubectl run busybox --image=busybox --restart=Never --overrides='
      {
         "apiVersion": "v1",
         "kind": "Pod",
         "metadata": {
            "labels": {
               "test": "liveness"
            },
            "name": "liveness-exec"
         },
         "spec": {
            "containers": [
               {
                  "name": "liveness",
                  "image": "k8s.gcr.io/busybox",
                  "livenessProbe": {
                     "exec": {
                        "command": [
                           "cat",
                           "/tmp/healthy"
                        ]
                     },
                     "initialDelaySeconds": 5,
                     "periodSeconds": 5
                  }
               }
            ]
         }
      }
      '
于 2020-05-15T09:38:40.010 回答
1

尽管这可能不是您在生产中真正想要做的事情,但您可以按照以下步骤操作。

  1. 从集群中获取 yamlkubectl get pod podname -o yaml --export > pod.yaml

  2. 删除正在运行的 podkubectl deplete pod podname

  3. 编辑pod.yaml并将其应用到集群。

于 2020-05-14T15:21:26.660 回答