What operations are available in a kubernetes patch?

Viewed 2097

kubectl patch --help gives an example where you can patch a specific element with a specific operation:

kubectl patch pod valid-pod --type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new
image"}]'

However, there's no enumeration of possible op values. What operations are available?

1 Answers

Kubectl patch uses json patch under the hood. Possible op's are : Replace, Add, Remove

Example:

[
  { "op": "replace", "path": "/baz", "value": "boo" },
  { "op": "add", "path": "/hello", "value": ["world"] },
  { "op": "remove", "path": "/foo" }
]

Related