Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to patch statefulset on kubernetes cluster and set imagePullPolicy

Need to understand exactly how patch works. How could I patch "imagePullPolicy" for instance. Could someone explain in simple details how patch works.

kubectl patch statefulset my-set -p '{"spec":{"containers":{"imagePullPolicy":"IfNotPresent"}}}'

This is not working what is wrong with it?

like image 781
Janis Karklins Avatar asked Sep 13 '25 06:09

Janis Karklins


1 Answers

In addition to @Colwins answer, you should also add mandatory key name into container spec, otherwise you'll get does not contain declared merge key: name

So, you kubectl command should look like:

kubectl patch statefulset my-set -p '{"spec": {"template": {"spec":{"containers":[{"name":"nginx","imagePullPolicy":"Never"}]}}}}'
like image 57
A_Suh Avatar answered Sep 17 '25 19:09

A_Suh