2023-05-10 00:10:30 -07:00
|
|
|
# kubectl edit
|
|
|
|
|
|
|
|
> Edit Kubernetes resources.
|
|
|
|
> More information: <https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#edit>.
|
|
|
|
|
2025-08-16 13:19:00 +03:00
|
|
|
- Edit a pod in the default namespace:
|
2023-05-10 00:10:30 -07:00
|
|
|
|
2025-08-16 13:19:00 +03:00
|
|
|
`kubectl edit {{[po|pod]}}/{{pod_name}}`
|
2023-05-10 00:10:30 -07:00
|
|
|
|
2025-08-16 13:19:00 +03:00
|
|
|
- Edit a deployment in the default namespace:
|
2023-05-10 00:10:30 -07:00
|
|
|
|
2025-08-16 13:19:00 +03:00
|
|
|
`kubectl edit {{[deploy|deployment]}}/{{deployment_name}}`
|
2023-05-10 00:10:30 -07:00
|
|
|
|
2025-08-16 13:19:00 +03:00
|
|
|
- Edit a service in the default namespace:
|
2023-05-10 00:10:30 -07:00
|
|
|
|
2025-08-16 13:19:00 +03:00
|
|
|
`kubectl edit {{[svc|service]}}/{{service_name}}`
|
|
|
|
|
|
|
|
- Edit all entries of a given resource in a given namespace:
|
|
|
|
|
|
|
|
`kubectl edit {{resource}} {{[-n|--namespace]}} {{namespace}}`
|
2023-05-10 00:10:30 -07:00
|
|
|
|
|
|
|
- Edit a resource using a specific editor:
|
|
|
|
|
|
|
|
`KUBE_EDITOR={{nano}} kubectl edit {{resource}}/{{resource_name}}`
|
|
|
|
|
|
|
|
- Edit a resource in JSON format:
|
|
|
|
|
2025-04-22 15:48:30 +03:00
|
|
|
`kubectl edit {{resource}}/{{resource_name}} {{[-o|--output]}} json`
|