2025-03-14 21:59:59 -06:00
|
|
|
# kubectl edit
|
|
|
|
|
|
|
|
|
|
> Edit Kubernetes resources.
|
2025-12-16 10:20:31 -07:00
|
|
|
> More information: <https://kubernetes.io/docs/reference/kubectl/generated/kubectl_edit>.
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Edit a pod in the default namespace:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`kubectl edit {{[po|pods]}}/{{pod_name}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Edit a deployment in the default namespace:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`kubectl edit {{[deploy|deployment]}}/{{deployment_name}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
- Edit a service in the default namespace:
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2025-12-16 10:20:31 -07:00
|
|
|
`kubectl edit {{[svc|service]}}/{{service_name}}`
|
|
|
|
|
|
|
|
|
|
- Edit all entries of a given resource in a given namespace:
|
|
|
|
|
|
|
|
|
|
`kubectl edit {{resource}} {{[-n|--namespace]}} {{namespace}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Edit a resource using a specific editor:
|
|
|
|
|
|
|
|
|
|
`KUBE_EDITOR={{nano}} kubectl edit {{resource}}/{{resource_name}}`
|
|
|
|
|
|
|
|
|
|
- Edit a resource in JSON format:
|
|
|
|
|
|
2025-05-08 12:26:01 -06:00
|
|
|
`kubectl edit {{resource}}/{{resource_name}} {{[-o|--output]}} json`
|