1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-08-23 00:44:10 +02:00
tldr/pages/common/kubectl-apply.md

30 lines
1.1 KiB
Markdown
Raw Normal View History

# kubectl apply
> Manage applications through files defining Kubernetes resources.
> Create and update resources in a cluster.
> More information: <https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply>.
2025-08-16 10:22:41 +03:00
- Apply a configuration to a resource by file name:
2025-08-16 10:22:41 +03:00
`kubectl apply {{[-f|--filename]}} {{path/to/filename}}`
- Apply a configuration to a resource from `kustomization.yaml` in a directory:
`kubectl apply {{[-k|--kustomize]}} {{path/to/directory}}`
- Apply a configuration to a resource by `stdin`:
`{{cat pod.json}} | kubectl apply {{[-f|--filename]}} -`
- Edit the latest last-applied-configuration annotations of resources from the default editor:
2025-08-16 10:22:41 +03:00
`kubectl apply edit-last-applied {{[-f|--filename]}} {{path/to/filename}}`
- Set the latest last-applied-configuration annotations by setting it to match the contents of a file:
2025-08-16 10:22:41 +03:00
`kubectl apply set-last-applied {{[-f|--filename]}} {{path/to/filename}}`
- View the latest last-applied-configuration annotations by type/name or file:
2025-08-16 10:22:41 +03:00
`kubectl apply view-last-applied {{[-f|--filename]}} {{path/to/filename}}`