kubectl patch: add port to deployment's pod template
How about this:
kubectl patch deployment spark-master --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/ports/-", "value": {"containerPort": 6066}}]'
Edit: removed "protocol": "TCP"
as suggested.
Edit #2 (to address Magellan's comment): The default type for patch
is --type='strategic'
. The attempted patch uses JSON Patch and hence the --type='json'
argument had to be added to make the command work.