IlBosco
IlBosco

Reputation: 1

Kubernetes: Update pod liveness probe timeoutSeconds

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.

Upvotes: 0

Views: 4211

Answers (2)

hariK
hariK

Reputation: 3059

You can use kubectl --overrides flag. Something similar to this,

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
                  }
               }
            ]
         }
      }
      '

Upvotes: 0

Arghya Sadhu
Arghya Sadhu

Reputation: 44579

Although this may not be something you really want to do in production but you can follow these steps.

  1. Get the yaml from the cluster kubectl get pod podname -o yaml --export > pod.yaml

  2. Delete the running pod kubectl deplete pod podname

  3. Edit the pod.yaml and apply it to the cluster.

Upvotes: 1

Related Questions