Commands.app

kubectl apply

Resource Management

Apply configuration to resources

Options & Flags
Available options for this command
-f

Filename, directory, or URL

-k

Kustomize directory

--dry-run

Preview changes

--prune

Remove resources not in config

Examples
Common usage examples

Apply single file

kubectl apply -f deployment.yaml

Apply all files in directory

kubectl apply -f ./manifests/

Apply kustomize configuration

kubectl apply -k ./kustomize/

Apply from stdin

kubectl apply -f - <<EOF apiVersion: v1 kind: Pod ... EOF
Notes
  • Preferred for declarative config management
  • Creates or updates resources
Related Commands
You might also find these useful