kubectl apply
Resource ManagementApply configuration to resources
Options & Flags
Available options for this command
-fFilename, directory, or URL
-kKustomize directory
--dry-runPreview changes
--pruneRemove resources not in config
Examples
Common usage examples
Apply single file
kubectl apply -f deployment.yamlApply 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
...
EOFNotes
- Preferred for declarative config management
- Creates or updates resources
Related Commands
You might also find these useful