4

We can restart kubernetes deployment using kubectl rollout restart. I want to perform same action using kubernetes api server.

1 Answer 1

4

You can use this Curl to restart using the API

curl --location --request PATCH 'http://<K8s cluster IP>:6443/apis/apps/v1/namespaces/<Namespace name>/deployments/<Deployment name>?fieldManager=kubectl-rollout&pretty=true' \
--header 'Content-Type: application/strategic-merge-patch+json' \
--data-raw '{
    "spec": {
        "template": {
            "metadata": {
                "annotations": {
                    "kubectl.kubernetes.io/restartedAt": <time.Now()>
                }
            }
        }
    }
}'

this will inject the annotation in deployment and restart the deployment.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.