KUBERNETES(1) kubernetes KUBERNETES(1) (NAME) kubectl-apply - (stdin) (SYNOPSIS) kubectl apply [OPTIONS] (DESCRIPTION) (stdin). . . 'apply' 'apply' 'create --save- config' . JSON YAML . : --prune . . : https://issues.k8s.io/34274 (OPTIONS) --all=false . --allow-missing-template-keys=true true map . golang jsonpath . --cascade="background" "background" "orphan" "foreground" . ( ReplicationController) . : background. --dry-run="none" "none" "server" "client" . client . server . --field-manager="kubectl-client-side-apply" . -f, --filename=[] . --force=false true API (graceful deletion) . . --force-conflicts=false true (server-side apply) . --grace-period=-1 . . 1 . --force true 0 ( ). -k, --kustomize="" kustomization. -f -R . --openapi-patch=true true openapi openapi openapi (diff) . . -o, --output="" . : (json, yaml, kyaml, name, go-template, go-template- file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath- file). --overwrite=true --prune=false apply create --save-config . -l --all . --prune-allowlist=[] (allowlist) --prune --record=false kubectl (annotation) . false . true . annotation . -R, --recursive=false -f, --filename. . -l, --selector="" ( ) '=', '==', '!=', 'in', 'notin' ( -l key1=value1,key2=value2,key3 in (value3)). . --server-side=false true apply . --show-managed-fields=false true JSON YAML managedFields . --subresource="" apply (subresource) . --server-side . --template="" -o=go-template -o=go-template-file . [http://golang.org/pkg/text/template/#pkg- overview]. --timeout=0s --validate="strict" : strict ( true) warn ignore ( false) . "true" "strict" . ServerSideFieldValidation api-server . "warn" API server "ignore" . "false" "ignore" . --wait=false true . (finalizers) . (OPTIONS INHERITED FROM PARENT COMMANDS) --as="" (impersonate) . (service account) namespace . --as-group=[] . --as-uid="" UID . --as-user-extra=[] . --cache-dir="/home/username/.kube/cache" --certificate-authority="" (certificate authority) --client-certificate="" TLS --client-key="" TLS --cluster="" kubeconfig --context="" kubeconfig --disable-compression=false true --insecure-skip-tls-verify=false true . HTTPS --kubeconfig="" kubeconfig CLI. --kuberc="" kuberc (preferences). export feature gate KUBECTL_KUBERC=false KUBERC=off . --match-server-version=false -n, --namespace="" namespace CLI --password="" (basic authentication) API --profile="none" . (none|cpu|heap|goroutine|threadcreate|block|mutex|trace) --profile-output="profile.pprof" --request-timeout="0" . ( 1s 2m 3h). ( timeout). -s, --server="" Kubernetes API --tls-server-name="" . hostname --token="" Bearer API --user="" kubeconfig --username="" API --version=false --version --version=raw --version=vX.Y.Z... --warnings-as-errors=false (EXAMPLES) # pod.json kubectl apply -f ./pod.json # kustomization.yaml - dir/kustomization.yaml kubectl apply -k dir/ # JSON (stdin) cat pod.json | kubectl apply -f - # '.json' kubectl apply -f '*.json' # : --prune # manifest.yaml app=nginx app=nginx kubectl apply --prune -f manifest.yaml -l app=nginx # manifest.yaml (ConfigMap) kubectl apply --prune -f manifest.yaml --all --prune-allowlist=core/v1/ConfigMap (SEE ALSO) kubectl(1), kubectl-apply-edit-last-applied(1), kubectl-apply-set-last- applied(1), kubectl-apply-view-last-applied(1), (HISTORY) Eric Paris (eparis at redhat dot com) kubernetes ! Eric Paris Jan 2015 KUBERNETES(1)