We can restart kubernetes deployment using kubectl rollout restart. I want to perform same action using kubernetes api server.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With