kubectl apply
Jump to navigation
Jump to search
↑ https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#apply
kubectl apply
apply a configuration to a resource by filename or stdin
[1]
--recursive
kubectl apply -f your.yaml -n your-namespace
kubectl apply --dry-run=server
kubectl apply --server-side
- Dashboard:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.4.0/aio/deploy/recommended.yaml
- Istio install:
kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml
kubectl apply -f https://k8s.io/examples/application/mysql/mysql-pv.yaml persistentvolume/mysql-pv-volume created persistentvolumeclaim/mysql-pv-claim created
Contents
Activities[edit]
Errors[edit]
Cannot unmarshal XXXXX into Go struct field
Operation cannot be fulfilled on ...
the object has been modified; please apply your changes to the latest version and try again
kubectl apply -f ./file.yaml Error from server (InternalError): error when creating "./file.yaml": Internal error occurred: failed calling webhook "virtualmachines- mutator.kubevirt.io": Post https://virt-api.kubevirt.svc:443/virtualmachines-mutate?timeout=30s: service "virt-api" not found
Warning: resource configmaps/kube-root-ca.crt is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically. secret/default-token-7z4zd created Error from server (Conflict): error when applying patch: .../... to: Resource: "/v1, Resource=configmaps", GroupVersionKind: "/v1, Kind=ConfigMap" Name: "kube-root-ca.crt", Namespace: "your-namespace" for: "your.yaml": Operation cannot be fulfilled on configmaps "kube-root-ca.crt": the object has been modified; please apply your changes to the latest version and try again
error: error parsing yourfile: error converting YAML to JSON: yaml: line 11: mapping values are not allowed in this context
error: error validating "yourfile": error validating data: [ValidationError(PersistentVolumeClaim.metadata.finalizers): invalid type for io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta.finalizers: got "string", expected "array", ValidationError(PersistentVolumeClaim): unknown field "name" in io.k8s.api.core.v1.PersistentVolumeClaim ]; if you choose to ignore these errors, turn validation off with --validate=false
Warning[edit]
Warning: resource endpoints/your-endpoint is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically. endpoints/your-endpoint configured
Related[edit]
kubectl create
kubectl edit
kubectl run
kubectl get
kubectl apply --server-side
kubectl delete
- creationTimestamp metadata
- Terraform resource:
kubernetes_deployment
See also[edit]
kubectl apply, --server-side, -k, -f, creationTimestamp, kubectl.kubernetes.io/last-applied-configuration, --validate=false
Advertising: