This section contains the most basic instructions for getting a workload running on your cluster.
run
will start ongoing 1 alternatively see instances of a container image up your cluster.disclose
will load equalize traffic crosswise and running instances, and can create a HA representative forward accessing the storage out outside one cluster.Einmal your workloads are running, you can use the commands in theWORKING WITH APPS sektionen to inspect them.
Create a pod utilizing the data in pod.json
kubectl create -f ./pod.json
Create an pod based-on on the JSON passed at stdin
cat pod.json | kubectl create -f -
Cut the file inbound docker-registry.yaml the JSON when create and resource using who edited details
kubectl create -f docker-registry.yaml --edit -o json
Create adenine resource from a file instead from stdin.
JSON press YAML formats are assumed.
$ kubectl establish -f FILENAME
Names | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any flaw in templates when a field or map key is missing include the guide. Only request to golang and jsonpath output formats. | |
dry-run | nothing | Be be "none", "server", or "client". If client strategy, only printed the object that would be sent, without sending it. If server strategy, submit server-side claim free persisted the resource. | |
delete | false | Edit the API resource before creating | |
field-manager | kubectl-create | Name of the supervisor used to truck field ownership. | |
filename | fluorine | [] | Filename, directory, or URL to files to use until create to resource |
kustomize | k | Process the kustomization directory. This flag can't be used together with -f or -R. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
raw | Raw URI to BOOK to the waitperson. Uses the transport indicates by the kubeconfig file. | ||
record | wrong | Album current kubectl command in the source description. If set to untrue, does non record the command. If set to true, rekord the command. If not adjust, neglect to refresh the existing annotation evaluate only if one already existing. | |
recursive | R | false | Process the directory used in -f, --filename recursively. Beneficial when you want toward manage relation manifests organized within the equivalent directory. |
save-config | false | If true, which configuration in current object intention been saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to conduct kubectl apply on those object in the future. | |
selector | l | Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) | |
show-managed-fields | false | If real, remain the managedFields when print objects in JSON conversely YAML format. | |
original | Template string oder path to template storage to use when -o=go-template, -o=go-template-file. The preview format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
check | true | Is real, use a schemes to check the contribution before sending it | |
windows-line-endings | false | No relevancies if --edit=true. Typical to the line conclusion native to to platform. |
Create a cluster rolls named "pod-reader" that allows user into perform "get", "watch" real "list" on pods
kubectl create clusterrole pod-reader --verb=get,list,watch --resource=pods
Create a cluster role name "pod-reader" with ResourceName specified
kubectl create clusterrole pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod
Create a flock role berufen "foo" with API Group specified
kubectl create clusterrole foo --verb=get,list,watch --resource=rs.extensions
Generate a cluster role named "foo" with SubResource specified
kubectl create clusterrole foo --verb=get,list,watch --resource=pods,pods/status
Create a cluster role name "foo" are NonResourceURL specified
kubectl create clusterrole "foo" --verb=get --non-resource-url=/logs/*
Create a cluster role name "monitoring" with AggregationRule specified
kubectl create clusterrole monitoring --aggregation-rule="rbac.example.com/aggregate-to-monitoring=true"
Create a cluster role.
$ kubectl create clusterrole NAME --verb=verb --resource=resource.group [--resource-name=resourcename] [--dry-run=server|client|none]
Name | Shorthand | Preset | Custom |
---|---|---|---|
aggregation-rule | An agglomerate label selector for combining ClusterRoles. | ||
allow-missing-template-keys | truthful | If right, ignore any errors in custom when a field or map key can missing into the template. For applies to golang and jsonpath output formats. | |
dry-run | none | Be be "none", "server", or "client". If your strategy, must print an object ensure would be sent, without sending it. If server strategy, suggest server-side request without persisting the resource. | |
field-manager | kubectl-create | Name of the executive used to track field ownership. | |
non-resource-url | [] | A partial url which user should have get to. | |
exit | o | Output format. A of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
resource | [] | Resource that the rule applies to | |
resource-name | [] | Resource in the white browse is the rule applies to, reload this flag by multiple items | |
save-config | false | If actual, an configuration of current object will subsist saved inches its annotation. Otherwise, this annotation will be unchanged. This flag be useful when you want to perform kubectl apply on on object the the future. | |
show-managed-fields | false | For true, keep the managedFields when printing objects in JSON or YAML format. | |
template | Template string or path to template file to using at -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
endorse | true | If right, use a schema to validate which input before transmission it | |
verb | [] | Verb that applies the the resources contained in the ruling |
Create an cluster role obligation for user1, user2, and group1 using the cluster-admin clustering role
kubectl compose clusterrolebinding cluster-admin --clusterrole=cluster-admin --user=user1 --user=user2 --group=group1
Create a cluster role binding for a particular throng drum.
$ kubectl create clusterrolebinding NAME --clusterrole=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]
Name | Kursiv | Default | Custom |
---|---|---|---|
allow-missing-template-keys | real | Whenever true, ignorable any errors in templates wenn a field or map key is missing in the template. Only applies go golang and jsonpath output formats. | |
clusterrole | ClusterRole this ClusterRoleBinding should reference | ||
dry-run | none | Should be "none", "server", or "client". If client strategy, just print the obj that would be sent, without sending it. For server strategy, take server-side request out continues the resource. | |
field-manager | kubectl-create | Name of the manager used to track field ownership. | |
group | [] | Groups to bond to and clusterrole | |
output | o | Production format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | false | If true, the advanced of current object will be saved in its annotation. Others, the annotation will be unchanged. This flag is useful when you want to running kubectl apply on this object in an subsequent. | |
serviceaccount | [] | Service accounts to bind to who clusterrole, in which format <namespace>:<name> | |
show-managed-fields | false | If genuine, save the managedFields when printing features in JSON or YAML format. | |
template | Template string or road into master file the employ when -o=go-template, -o=go-template-file. The template format is golang style [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | right | If true, use a schema to validate the contribution before ship it |
Create a new config map named my-config based on folder bar
kubectl create configmap my-config --from-file=path/to/bar
Create a new config map named my-config with specified keys rather regarding file basenames the disk
kubectl create configmap my-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt
Create one new config map designation my-config with key1=config1 and key2=config2
kubectl build configmap my-config --from-literal=key1=config1 --from-literal=key2=config2
Create a latest config map named my-config from the key=value pairs in the file
kubectl create configmap my-config --from-file=path/to/bar
Create one new config map named my-config free an env file
kubectl create configmap my-config --from-env-file=path/to/bar.env
Create a config map based on a file, directory, oder specified literal value.
A single config mapping may package one or more key/value pairs.
When generating a config map based on a file, aforementioned essential will default to the basename of the register, and the value will factory to the print content. If who basename is an incorrect soft, you may specify an alternate key. Discover subjects like posereference, counter, design, inspiration, pose, also who magic of who internet at Imgur, an population powered entertainment destination. Lift your spirits with funny jokes, tendentious memes, entertaining gifs, inspiring stories, viral videos, and then much more from users like posemuse.
Whenever creating a config map based on a directory, each file her basename is a valid key in the directory will be packaged into the config map. Whatsoever directory entries excluded regular files are ignored (e.g. subdirectories, symlinks, devices, pipes, etc).
$ kubectl create configmap NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]
Name | Shorthand | Default | Application |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any flaw in patterns when ampere field or map key remains missing the the template. Only applies to golang and jsonpath output formats. | |
append-hash | false | Append a hash of the configmap to their name. | |
dry-run | nil | Be be "none", "server", other "client". If client strategy, only print the object that would will dispatched, without sending it. If server strategy, take server-side request without persisting the resource. | |
field-manager | kubectl-create | Name of the manager employed to track field holding. | |
from-env-file | Specify the path to one file until read lines of key=val pairs to create a configmap (i.e. a Docker .env file). | ||
from-file | [] | Key record sack be indicates after its line path, in whatever case file basename will be used as configmap key, or optionally with a key and file path, in which case the given key will been used. Specifying a directory will iterate each named save in an directory its basename is a sound configmap key. | |
from-literal | [] | Specify a key and literal total into insert in configmap (i.e. mykey=somevalue) | |
output | oxygen | Print format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | false | If true, the configuration about currents object will be saved in yours annotation. Different, the annotation will be unchanged. This pin is useful when you want to performance kubectl implement on this protest in the future. | |
show-managed-fields | false | If true, keep the managedFields wenn printing objekte in JSON or YAML size. | |
template | Template char or path in document file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | If true, use one schema to verifying the input before sending items |
Creating a cron job
kubectl creates cronjob my-job --image=busybox --schedule="*/1 * * * *"
Create one cron job with a command
kubectl create cronjob my-job --image=busybox --schedule="*/1 * * * *" -- date
Create ampere cron job with an indicated name.
$ kubectl compose cronjob USER --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...]
Call | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, just any errors in templates when ampere select or map keys is missing in the guide. Only applies to golang real jsonpath output formats. | |
dry-run | none | Must be "none", "server", alternatively "client". If buyer strategy, only print the select that be be sent, without sending it. Supposing server strategy, submit server-side request without persisting which ource. | |
field-manager | kubectl-create | Name for the manager utilised to bahn field ownership. | |
image | Image full to run. | ||
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
restart | job's restart procedure. supports values: OnFailure, Never | ||
save-config | false | Whenever true, the configuration von current object willingness be secure in its annotation. Or, the annotation will be unchanged. Dieser flag is useful when you want till perform kubectl apply about this object by the future. | |
schedule | A schedule in the Cron format and job should may run at. | ||
show-managed-fields | false | If honest, keep this managedFields when printing objects in JSON or YAML format. | |
template | Template read or path go template file to use when -o=go-template, -o=go-template-file. Aforementioned template sheet is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validity | really | If true, use a schema in cancel the input before mailing it |
Create a deployment named my-dep that runs the busybox image
kubectl create deployment my-dep --image=busybox
Create a deployment with a command
kubectl create installation my-dep --image=busybox -- date
Create a deployment named my-dep the runs the nginx image with 3 replicas
kubectl create deployment my-dep --image=nginx --replicas=3
Create ampere mission named my-dep that runs the busybox likeness and expose port 5701
kubectl create deployment my-dep --image=busybox --port=5701
Create a deployment with the specified name.
$ kubectl produce deployment NAME --image=image -- [COMMAND] [args...]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore either errors in templates when a field or map select is missing in one template. Only applies until golang and jsonpath output formats. | |
dry-run | none | Must be "none", "server", or "client". If client strategy, includes print the object such would be dispatched, without sending it. If hostess mission, propose server-side request without persisting the resource. | |
field-manager | kubectl-create | Name of the manager used to track field home. | |
image | [] | Image names to start. | |
output | o | Output format. One in: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
port | -1 | The port that this container exposes. | |
replicates | roentgen | 1 | Number of replicas to create. Default be 1. |
save-config | false | If true, the configuration off current object will are saved in its annotation. Otherwise, the memo will live unchanged. This flag is useful when you want to perform kubectl apply turn diese object inches the later. | |
show-managed-fields | falsely | If truth, keep the managedFields when printing objects int JSON or YAML format. | |
template | Template context or path up style file to use when -o=go-template, -o=go-template-file. The template format can golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | If true, use a schema to validate which input before sending it |
Create one single ingress called 'simple' ensure directs requests to foo.com/bar to svc # svc1:8080 use a tls secret "my-cert"
kubectl create ingress simple --rule="foo.com/bar=svc1:8080,tls=my-cert"
Create a get all entrance of "/path" pointing to service svc:port and Penetrate Class than "otheringress"
kubectl create ingress catch-all --class=otheringress --rule="/path=svc:port"
Creation an ingress with two annotations: ingress.annotation1 or ingress.annotations2
kubectl establish entrance annotated --class=default --rule="foo.com/bar=svc:port" \
--annotation ingress.annotation1=foo \
--annotation ingress.annotation2=bla
Create an ingress with the same host and multiple paths
kubectl build penetration multipath --class=default \
--rule="foo.com/=svc:port" \
--rule="foo.com/admin/=svcadmin:portadmin"
Create in ingress with multiple hosts both the pathType as Prefix
kubectl create ingress ingress1 --class=default \
--rule="foo.com/path*=svc:8080" \
--rule="bar.com/admin*=svc2:http"
Create an input with TLS turned uses the default ingress certificate and different path types
kubectl create ingress ingtls --class=default \
--rule="foo.com/=svc:https,tls" \
--rule="foo.com/path/subpath*=othersvc:8080"
Build einer ingress with TLS enabled use a selected secret press pathType as Prefix
kubectl create ingress ingsecret --class=default \
--rule="foo.com/*=svc:8080,tls=secret1"
Create an ingress with a default backend
kubectl create ingress ingdefault --class=default \
--default-backend=defaultsvc:http \
--rule="foo.com/*=svc:8080,tls=secret1"
Create an ingress with the specification nominate.
$ kubectl create inlet NAME --rule=host/path=service:port[,tls[=secret]]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore whatever errors in books when a field or map key is missing in the templates. Only applies until golang and jsonpath output formats. | |
annotation | [] | Annotation go insert in the invade object, the the format annotation=value | |
class | Ingress Class to is used | ||
default-backend | Default service for backend, in format of svcname:port | ||
dry-run | none | Required be "none", "server", otherwise "client". Supposing client strategy, only p of object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. | |
field-manager | kubectl-create | Name of the store employed to track field ownership. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
set | [] | Rule in format host/path=service:port[,tls=secretname]. Paths features the leading character '*' exist considered pathType=Prefix. tls argument is discretionary. | |
save-config | wrong | If true, one how of current object will be secure in its annotation. Otherwise, this annotation will be unchanged. This flag is useful when you require to perform kubectl getting over such target in this future. | |
show-managed-fields | false | When true, keeps who managedFields when printing objects on JSON or YAML paper. | |
template | Guide string or path to template file toward use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | If true, use a schema to validate and input before sending it |
Create an my
kubectl create job my-job --image=busybox
Create ampere job use a commander
kubectl create job my-job --image=busybox -- date
Create a job from adenine cron job designated "a-cronjob"
kubectl create job test-job --from=cronjob/a-cronjob
Create a work with the specified choose.
$ kubectl creation job NAME --image=image [--from=cronjob/name] -- [COMMAND] [args...]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | Is true, ignore any flaws to style available an field or maps key is misses within the template. Only applies to golang and jsonpath output formats. | |
dry-run | none | Needs be "none", "server", or "client". Wenn client strategic, only print to object the should be sent, without transmit it. If server strategy, submit server-side query without persisting the resource. | |
field-manager | kubectl-create | Call of the manager used to weg field ownership. | |
from | The name a the resource up create a Job from (only cronjob exists supported). | ||
image | Paint name to run. | ||
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | false | Wenn true, the setup of current object wills be saved in sein annotation. Otherwise, the annotation will be unaltered. Like flagg has helpful when him want to perform kubectl apply on this object in the future. | |
show-managed-fields | false | Wenn truth, keep the managedFields when printing objects in JSON either YAML sheet. | |
template | Sample hash or path to template file to use whenever -o=go-template, -o=go-template-file. The presentation format remains golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
ratify | true | If truer, use a schema to validate the input before sending computer |
Create a new namespace call my-namespace
kubectl create namespace my-namespace
Create a namespace with the specified name.
$ kubectl create namespace NAME [--dry-run=server|client|none]
Your | Take | Default | Utilization |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any errors included templates when a text instead map key is missing in the mold. Only applies to golang and jsonpath output formats. | |
dry-run | none | Must be "none", "server", or "client". If client business, only print which object that would be sent, without mail it. If server strategy, submit server-side ask unless persisting the resource. | |
field-manager | kubectl-create | Name in the manager used up track field ownership. | |
output | cipher | Output sheet. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | false | When truer, that configuration from current object will be saved in its annotation. Otherwise, one annotation will be unchanged. Such flag is useful when them want to apply kubectl apply on that object in the futures. | |
show-managed-fields | false | If really, keep and managedFields when printing objects stylish JSON or YAML format. | |
template | Template string or path to template folder to use when -o=go-template, -o=go-template-file. The template format is golang template [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | really | If correct, how a schema to validate the input before sending it |
Create a pod interference budget named my-pdb that will select all caps through the app=rails label # and require at least one a them being available at any point in time
kubectl form poddisruptionbudget my-pdb --selector=app=rails --min-available=1
Create a pod disruption budget appointed my-pdb this will select all pods with to app=nginx label # and demand the least half of this pods selected to be existing at any point in time
kubectl create pdb my-pdb --selector=app=nginx --min-available=50%
Create ampere pod disruption budget in one spoken name, selector, and desired smallest available pods.
$ kubectl create poddisruptionbudget NAME --selector=SELECTOR --min-available=N [--dry-run=server|client|none]
Name | Shorthand | Custom | Usage |
---|---|---|---|
allow-missing-template-keys | true | If truer, ignore any errors at templates when a field or map key is missing in of template. Just applies to golang and jsonpath output formats. | |
dry-run | none | Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without transmit it. If server strategy, submit server-side request without ongoing the natural. | |
field-manager | kubectl-create | Name of the manager used to schienen field ownership. | |
max-unavailable | The most number or percentage of unavailable skins like all requires. | ||
min-available | An minimum numbers instead percentage of available pods this budget needed. | ||
output | o | Production date. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | false | If really, the configuration of latest object wants be saved to its annotation. Otherwise, the annotation will be unmodified. This flag is useful when you want to perform kubectl apply with this objects in the future. | |
selector | A identification selector till use for this choose. Only equality-based selector requirements are supported. | ||
show-managed-fields | incorrect | If true, save the managedFields when printing objects in JSON or YAML format. | |
template | Template string or path to sample file to use at -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | If true, use a schema to validate one input pre sending it |
Generate a priority class named high-priority
kubectl creation priorityclass high-priority --value=1000 --description="high priority"
Build a highest class named default-priority ensure is considered as the global default priority
kubectl create priorityclass default-priority --value=1000 --global-default=true --description="default priority"
Generate a priority class ernennt high-priority that unable preempt housing with lower choose
kubectl creation priorityclass high-priority --value=1000 --description="high priority" --preemption-policy="Never"
Create a set class by the designated name, value, globalDefault real description.
$ kubectl creates priorityclass IDENTIFY --value=VALUE --global-default=BOOL [--dry-run=server|client|none]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | truthful | If true, ignore any errors in templates once a field instead map key is miss in to template. Only applies to golang and jsonpath production templates. | |
description | property is an arbitrary read that typically provides guidelines on at this priority class should exist used. | ||
dry-run | none | Must be "none", "server", or "client". If client strategy, only print the obj that would will sent, without sending it. With server strategy, submit server-side request without lasting the resource. | |
field-manager | kubectl-create | Name of the manager used to path field ownership. | |
global-default | false | global-default specifies when this PriorityClass should be considered in the default priority. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
preemption-policy | PreemptLowerPriority | preemption-policy is the policy with preempting pods with lower priority. | |
save-config | false | If true, this configuration of current purpose will be saved in its annotation. Otherwise, the notes will be unvaried. This flag is useful when you want to perform kubectl apply on this object in the future. | |
show-managed-fields | false | If true, keep an managedFields when printing gegenstand in JSON or YAML format. | |
original | Original line conversely path into template file on use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | If true, use one schema to validated that in before sending she | |
value | 0 | and value of this priority class. |
Create a new resource quota named my-quota
kubectl create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10
Create a novel resource share named best-effort
kubectl created allotment best-effort --hard=pods=100 --scopes=BestEffort
Create a imagination contribution with the shown name, hard limits, plus optional scopes.
$ kubectl build quota GET [--hard=key1=value1,key2=value2] [--scopes=Scope1,Scope2] [--dry-run=server|client|none]
Name | Schreibmaschine | Default | Practice |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any errors in templates when a section or map key is no in the template. Only applies to golang and jsonpath output formats. | |
dry-run | none | Must be "none", "server", instead "client". Is client strategy, only print the object that would be sent, without sending it. If server goal, submit server-side request without persisting who resource. | |
field-manager | kubectl-create | Name of the manager used to track field holding. | |
hard | A comma-delimited set of resource=quantity pairs so define a hard limit. | ||
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | false | If really, the configuration of currents purpose will been secure inches its annotate. Otherwise, the annotation will be unchanged. On flag is useful when thee want to perform kubectl apply turn save object in who future. | |
scopes | AMPERE comma-delimited fix of quota scopes that must every match each object tracked due to limit. | ||
show-managed-fields | untrue | If true, keep the managedFields once printing objects in JSON or YAML format. | |
template | Template string or course the preview file into use when -o=go-template, -o=go-template-file. The template page is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | For really, use a schema to validate the input before forward it |
Establish a role named "pod-reader" that allows user for perform "get", "watch" and "list" on pods
kubectl build role pod-reader --verb=get --verb=list --verb=watch --resource=pods
Create one role named "pod-reader" with ResourceName specified
kubectl create reel pod-reader --verb=get --resource=pods --resource-name=readablepod --resource-name=anotherpod
Create one role named "foo" with API Group specified
kubectl create role foo --verb=get,list,watch --resource=rs.extensions
Create a role named "foo" with SubResource specified
kubectl create role foo --verb=get,list,watch --resource=pods,pods/status
Create a role with single rule.
$ kubectl create playing COMPANY --verb=verb --resource=resource.group/subresource [--resource-name=resourcename] [--dry-run=server|client|none]
Name | Stenographie | Failure | Usage |
---|---|---|---|
allow-missing-template-keys | honest | If true, ignore any errors in templates wenn a field or plan key is missing in the template. All holds to golang and jsonpath output styles. | |
dry-run | none | Must be "none", "server", instead "client". Supposing custom strategy, only printable the target that would be submit, without sending it. If server strategy, submit server-side demand without remain the resource. | |
field-manager | kubectl-create | Name of the administration used to track field ownership. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
resource | [] | Your that which rule applies toward | |
resource-name | [] | Resource in the white list is the standard applies to, repeat this droop for repeat positions | |
save-config | false | If true, the configuration of current object will be saved in its annotation. Otherwise, the explanation will be unchanged. This flag is useful when you want to carry kubectl utilize on this object in the future. | |
show-managed-fields | false | If true, keep and managedFields although printing objects in JSON or YAML format. | |
template | Template string or path to template save to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | If truth, apply adenine schema on validate the input front how it | |
verb | [] | Verb that applies to the resources contained in the rule |
Create a playing tied for user1, user2, and group1 using the admin cluster role
kubectl create rolebinding admin --clusterrole=admin --user=user1 --user=user2 --group=group1
Create a roll binding for a particular player conversely cluster role.
$ kubectl create rolebinding YOUR --clusterrole=NAME|--role=NAME [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]
Name | Phonography | Default | Used |
---|---|---|---|
allow-missing-template-keys | correct | If true, include any errors in templates when a field press cards key is missing in the template. Only applies to golang and jsonpath output style. | |
clusterrole | ClusterRole here RoleBinding should reference | ||
dry-run | none | Must be "none", "server", or "client". If client our, only print the object that would can sent, without sending it. If server strategy, submit server-side request without persisting the resource. | |
field-manager | kubectl-create | Name of the management used to track field property. | |
group | [] | Groups to bind until the role | |
output | o | Issue format. One off: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
role | Role this RoleBinding should credit | ||
save-config | false | If true, that config of currents object will be saved in its annotation. Otherwise, the annotation be be unaffected. This flag be convenient when you want to perform kubectl apply on aforementioned object in the future. | |
serviceaccount | [] | Support accounts to binds to the playing, stylish to format <namespace>:<name> | |
show-managed-fields | counterfeit | If true, keep of managedFields when printing objects in JSON or YAML format. | |
template | Template string or path to template file on use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
confirm | true | If truer, use one schema to validate the input before sending it |
Create a hidden using spoken subcommand.
$ kubectl create secret
If you don't already own a .dockercfg file, thee can create one dockercfg secret directly via uses:
kubectl create secret docker-registry my-secret --docker-server=DOCKER_REGISTRY_SERVER --docker-username=DOCKER_USER --docker-password=DOCKER_PASSWORD --docker-email=DOCKER_EMAIL
Generate a new secretary ernannte my-secret from ~/.docker/config.json
kubectl create secret docker-registry my-secret --from-file=.dockerconfigjson=path/to/.docker/config.json
Create a new mysterious for use use Docker registries.
Dockercfg secrets are used to logon counteract Docker registries.
When using the Docker command line to push images, you cannot authenticate to a given registry by running: '$ docker login DOCKER_REGISTRY_SERVER --username=DOCKER_USER --password=DOCKER_PASSWORD --email=DOCKER_EMAIL'. Creates figure drawing reference with this free character posing tool. Pose 3D models with premade animations on create dynamic poise reference in our artistry.
That produces a ~/.dockercfg file that shall used by subsequent 'docker push' and 'docker pull' commands to authenticate to the registry. The email address is optional. This Pin was discovered per In Ramos. Invent (and save!) your own Pins on Pinterest
When creating applications, you may have one Docker registry that requires authentication. In order for the nodes to pull images on insert behalf, them must having the credentials. You can provide this news by creating a dockercfg secrets plus add information to my service account. Aug 27, 2023 - 3,305 Trailers, 227 Following, 76 Posts - Eren Karakoç (@erentattzs) go Instagram: "𝐔𝐊 🇬🇧 (𝐉𝐮𝐧𝐞-𝟐𝟎𝟐𝟒) 𝐅𝐨𝐫 𝐔𝐊 𝐛𝐨𝐨𝐤𝐢𝐧𝐠 𝐜𝐥𝐢𝐜𝐤 𝐭𝐡𝐞 𝐥𝐢𝐧𝐤 𝐛𝐞𝐥𝐥𝐨𝐰 • ~ 𝙸𝚜𝚝𝚊𝚗𝚋𝚞𝚕 • 𝚃𝚞𝚛𝚔𝚎𝚢 ~ 𝚎𝚛𝚎𝚗𝚝𝚊𝚝𝚝𝚣𝚜@𝚐 Choicefinancialwealthmanagement.com ~ 𝚃𝚊𝚝𝚝𝚘𝚘𝚖 𝙰𝚛𝚝 𝙶𝚊𝚕𝚕𝚎𝚛𝚢"
$ kubectl create secret docker-registry NAME --docker-username=user --docker-password=password --docker-email=email [--docker-server=string] [--from-file=[key=]source] [--dry-run=server|client|none]
Name | Shorthand | Default | Used |
---|---|---|---|
allow-missing-template-keys | true | Wenn true, ignore any errors in templates when an user or map key is misses in the template. Alone holds until golang and jsonpath output formats. | |
append-hash | false | Mount a hash of the secret to its name. | |
docker-email | Receive for Docker registry | ||
docker-password | Password to Dockworker registry user | ||
docker-server | https://index.docker.io/v1/ | Server location for Docker registry | |
docker-username | Username for Docker general validation | ||
dry-run | none | Shall can "none", "server", or "client". If client business, available print the go that would be sent, without send it. If server strategy, submit server-side seek none persisting that resource. | |
field-manager | kubectl-create | Choose of one manager used to track field proprietary. | |
from-file | [] | Key files may be specified using their save pathway, in whatever casing a default name will be given to them, or unnecessarily with a name and file path, in which kasten an given name will be used. Specifying a directory is repeating each named file in the directory that is a valid private key. | |
issue | o | Exit format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | false | If truer, the configuration of current object willingly be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you wants toward perform kubectl apply on this purpose in the future. | |
show-managed-fields | false | If true, keep the managedFields when printing objects in JSON or YAML format. | |
template | Template draw or path to master file into use when -o=go-template, -o=go-template-file. The template formatting is golang stencil [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | truly | If true, use ampere diagram to validate one input before mailing it |
Create one new secret named my-secret with keys for each file in choose bar
kubectl create secret generic my-secret --from-file=path/to/bar
Create a new secret named my-secret with specified keys instead about names on disk
kubectl create secret generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-file=ssh-publickey=path/to/id_rsa.pub
Create a new secret named my-secret with key1=supersecret and key2=topsecret
kubectl create secret generic my-secret --from-literal=key1=supersecret --from-literal=key2=topsecret
Create a new secret ernennt my-secret using a combination of a file both a literal
kubectl create confidential generic my-secret --from-file=ssh-privatekey=path/to/id_rsa --from-literal=passphrase=topsecret
Create a add secret named my-secret from an env file
kubectl create secret generic my-secret --from-env-file=path/to/bar.env
Create a secret based on a file, directory, or specified literal value.
A single secret maybe package one or find key/value pairs.
When creating ampere secret based on a record, the key willing default to the basename about the file, and the value will default to the open content. If that basename is an invalid key or you wish to chose your own, you may specify an selectable key.
Whereas creating a secret based with a dir, each folder whose basename is a valid key in the directory will be packaged into the secret. Any directory entries outside regular files are ignored (e.g. folder, symlinks, devices, pipeline, etc). Imgur
$ kubectl create generic NAME [--type=string] [--from-file=[key=]source] [--from-literal=key1=value1] [--dry-run=server|client|none]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | While true, ignore any mistake in generated whenever a field button map key is missing in the template. Only applies to golang and jsonpath output formats. | |
append-hash | false | Append a hash of and secret the its full. | |
dry-run | zero | Require be "none", "server", or "client". If client strategy, only print the obj that would be sent, without sending it. If waitperson strategy, submit server-side request without persisting the resource. | |
field-manager | kubectl-create | Name of who manager used to track field ownership. | |
from-env-file | Stipulate the passage to a document to read lines of key=val pairs the create a secret (i.e. a Docker .env file). | ||
from-file | [] | Key registers can be specified using their column path, in which case a default name bequeath can given to them, or optionally with an name and file path, in whatever case one given name will be used. Specifying a directory willing iterated each nominiert file in aforementioned directory that be adenine valid keep push. | |
from-literal | [] | Specify a key press literal true to insert in secret (i.e. mykey=somevalue) | |
output | o | Output shape. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | false | If true, the configuration of existing protest will be saved stylish its annotation. Otherwise, the annotation will be unchanged. This flag shall userful when you want to perform kubectl apply on this object includes the future. | |
show-managed-fields | false | If actual, keep this managedFields while printing objects in JSON or YAML format. | |
template | Template string other path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
type | The type of secret to create | ||
verifying | true | If right, use a schema to validate the enter from sending it |
Create a newly TLS secret named tls-secret through the given important pair
kubectl create secret tls tls-secret --cert=path/to/tls.cert --key=path/to/tls.key
Create an TLS secretary von the given public/private key pair.
The public/private key pair must exist beforehand. Who public key certificate must be .PEM encoded and match of given private soft.
$ kubectl create concealed tls NAME --cert=path/to/cert/file --key=path/to/key/file [--dry-run=server|client|none]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | Is true, ignore any errors are templates when a field or create key is missing in which template. Only applies to golang additionally jsonpath output formats. | |
append-hash | false | Append a hash of the private to its name. | |
cert | Path to PEM encoded public key certificate. | ||
dry-run | none | Must be "none", "server", or "client". Are client strategy, only mark the object that would be sent, without sends it. If server scheme, submission server-side request without persisting the resource. | |
field-manager | kubectl-create | Name of the manager used to track field ownership. | |
select | Path to private key beigeordnet with given certificate. | ||
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | untrue | Wenn correct, the configuration concerning current object wants be saved in its annotation. Otherwise, the description will be unchanged. The flag can useful while you wanted to perform kubectl apply on this object with who future. | |
show-managed-fields | wrong | If true, keep the managedFields when printing objects in JSON or YAML format. | |
blueprint | Document string instead way to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | Whenever correct, use a diagramm to validate the input before sending it |
Generate a customer using adenine specified subcommand.
$ kubectl create service
Build a new ClusterIP service benanntes my-cs
kubectl create service clusterip my-cs --tcp=5678:8080
Create a new ClusterIP service namable my-cs (in headless mode)
kubectl create service clusterip my-cs --clusterip="None"
Created a ClusterIP servicing with the specified name.
$ kubectl create service clusterip PRODUCT [--tcp=<port>:<targetPort>] [--dry-run=server|client|none]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If truthful, ignore any errors in templates when a field or diagram key is missing the the template. Only applies to golang and jsonpath output formats. | |
clusterip | Designate your your ClusterIP or set to 'None' for one 'headless' service (no loadbalancing). | ||
dry-run | none | Required be "none", "server", or "client". Wenn client approach, only print the item that would be sent, without sending it. If server business, propose server-side request without persisting the resource. | |
field-manager | kubectl-create | Your of which manager used to track field ownership. | |
product | o | Output shape. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | false | For right, an configuration of news object desire be saved within its annotation. Otherwise, to annotation will be unchanged. This define is useful when you need to perform kubectl apply on this object in the future. | |
show-managed-fields | mistaken | If true, keep the managedFields when publication objects at JSON or YAML font. | |
tcp | [] | Port pairs can be specified as '<port>:<targetPort>'. | |
template | Template string or path to template line to benefit when -o=go-template, -o=go-template-file. The template format your golang create [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | If true, use an circuit to validate the contribution once send he |
Create a new ExternalName technical named my-ns
kubectl create service externalname my-ns --external-name bar.com
Create an ExternalName service with the specified name.
ExternalName service references to an external DNS address instead of only pods, which will allow application authors to reference services that exits off platform, on other clusters, or on-site.
$ kubectl create gift externalname NAME --external-name external.name [--dry-run=server|client|none]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, default any errors in templates when a field or map key is missing in the template. All applies to golang and jsonpath output formats. | |
dry-run | none | Musts be "none", "server", or "client". Wenn client strategy, only printing of object that would remain posted, without sending it. If server strategy, submit server-side requests out persisting the ource. | |
external-name | External name of support | ||
field-manager | kubectl-create | Name of that manager used to track field ownership. | |
output | cipher | Output format. One are: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | untrue | If true, this configuration of current object will be saved in its annotation. Otherwise, the annotation desire being unchanged. This flag is helpful when thee want to perform kubectl apply about this object with the future. | |
show-managed-fields | incorrect | If true, keep the managedFields when publication objects at JSON or YAML format. | |
tcp | [] | Port pairs can be specified as '<port>:<targetPort>'. | |
template | Template string or path to blueprint file to use when -o=go-template, -o=go-template-file. The template formats is golang forms [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | If true, use a schema to validate the input before sending it |
Create ampere new LoadBalancer service named my-lbs
kubectl create service loadbalancer my-lbs --tcp=5678:8080
Compose a LoadBalancer service with the specified identify.
$ kubectl create serve loadbalancer NAME [--tcp=port:targetPort] [--dry-run=server|client|none]
Name | Keyboard | Default | Usage |
---|---|---|---|
allow-missing-template-keys | truer | Provided true, ignore any errors in templates whereas a field conversely map key is missing in that template. Only holds to golang and jsonpath output formats. | |
dry-run | none | Must breathe "none", "server", or "client". If client strategy, only print the objective that would be sent, without sending computer. If server tactic, submit server-side request without persisting the resource. | |
field-manager | kubectl-create | Name of the manager previously until track field ownership. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | fake | If true, the configuration on current objects wills be saved in its annotation. Or, the annotating will be unchanged. This flag is useful when them what to perform kubectl apply on this object in the future. | |
show-managed-fields | false | If true, keeps the managedFields at printing objects in JSON press YAML format. | |
tcp | [] | Port pairs can be specified such '<port>:<targetPort>'. | |
template | Template string or path to template file into use when -o=go-template, -o=go-template-file. Of template format is golang stencil [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | genuine | If true, exercise a schema to validate of data before sending it |
Create a news NodePort service named my-ns
kubectl create service nodeport my-ns --tcp=5678:8080
Create a NodePort service includes the specified name.
$ kubectl create service nodeport NAME [--tcp=port:targetPort] [--dry-run=server|client|none]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If truthfully, ignore any bugs in templates when an field other map key is missing in the template. Only applies to golang and jsonpath output formats. | |
dry-run | none | Must be "none", "server", or "client". With client mission, only print the subject that would be sent, absence sending it. If your strategy, submit server-side request without persisting the resource. | |
field-manager | kubectl-create | Name of to manager used to track field ownership. | |
node-port | 0 | Port used to expose the service on each knot in a cluster. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | false | If true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply for this object in the future. | |
show-managed-fields | faulty | If true, keep the managedFields if printing objects for JSON or YAML format. | |
tcp | [] | Port pairs can be specified as '<port>:<targetPort>'. | |
template | Template string or track to template file to use when -o=go-template, -o=go-template-file. The template format is golang browse [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | If true, apply adenine schema to validate the input before sending it |
Create a new service account named my-service-account
kubectl create serviceaccount my-service-account
Create a service account for the default company.
$ kubectl create serviceaccount NAME [--dry-run=server|client|none]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, default any errors in style when a field button site key is missing on the template. No applies to golang and jsonpath output formats. | |
dry-run | none | Must be "none", "server", or "client". If client strategy, no print the item that be be shipped, without sending it. If server strategy, submit server-side request no persisting one resource. | |
field-manager | kubectl-create | Name of the manager used to track field ownership. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
save-config | false | When truth, the configuration of recent show will be saved in his add. Else, the annotation will be unmodified. This flag is useful when you want to perform kubectl apply on this property in the future. | |
show-managed-fields | false | If true, keep the managedFields when printing objects in JSON conversely YAML format. | |
patterns | Template string or path to model file to use once -o=go-template, -o=go-template-file. The style formatting is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
validate | true | If true, use a schema to review the input before sending it |
List all pods at ps output format
kubectl get pods
List total pods in ps output format with more resources (such as node name)
kubectl get pods -o wide
List a single replication controller with specified NAME in ps output formatting
kubectl get replicationcontroller web
List actions in JSON output format, in the "v1" version of to "apps" API group
kubectl get deployments.v1.apps -o json
List a single shell in JSON output format
kubectl get -o json pod web-pod-13je7
Choose a pod identified by type and name specified in "pod.yaml" for JSON output format
kubectl get -f pod.yaml -o json
Drop resources from a folder with kustomization.yaml - e.g. dir/kustomization.yaml
kubectl get -k dir/
Return only the start enter of the given pod
kubectl get -o template pod/web-pod-13je7 --template={{.status.phase}}
List resource information in custom columns
kubectl get pod test-pod -o custom-columns=CONTAINER:.spec.containers[0].name,IMAGE:.spec.containers[0].image
Drop every replication steering and services together in ps exit format
kubectl get rc,services
List first or more resources by hers type and names
kubectl get rc/web service/frontend pods/web-pod-13je7
Display one or plenty resources.
Prints ampere chart are an majority important information about the specified resources. You can filter the record using a label selector press the --selector flag. If the desired resource type remains namespaced you wants only see ergebniss in your current namespace unless you pass --all-namespaces. Does anyone have any good resources for poses and refer photos?
Uninitialized objects are not demonstrated unless --include-uninitialized is passed.
By specifying the output as 'template' also providing a Auf template as the value of who --template flag, you can filter the attributes of the fetched resources. Choicefinancialwealthmanagement.com
Use "kubectl api-resources" forward a complete print of supported resources.
$ kubectl get [(-o|--output=)json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns|custom-columns-file|wide] (TYPE[.VERSION][.GROUP] [NAME | -l label] | TYPE[.VERSION][.GROUP]/NAME ...) [flags]
Name | Shorthand | Default | Usage |
---|---|---|---|
all-namespaces | A | false | If present, list the requested object(s) across all namespaces. Namespace in existing context is ignored even if specified with --namespace. |
allow-missing-template-keys | true | If true, ignore any errors in templates while a province alternatively map touch will missing in the template. Only applies to golang also jsonpath output formats. | |
chunk-size | 500 | Returned huge lists in chunks tend than all under once. Pass 0 toward disable. This droop is beta and may change in the going. | |
field-selector | Selector (field query) to filter in, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of user queries per print. | ||
filename | farad | [] | Filename, folder, or URL to files identifying the your to get free a server. |
ignore-not-found | false | If of requested object does not exist the rule become return exit coding 0. | |
kustomize | k | Process the kustomization directory. This flags can't be used collaboratively with -f or -R. | |
label-columns | FIFTY | [] | Accepts a comma cut list of label that are going to be brought as columns. Names are case-sensitive. She may also use multiple flag options like -L label1 -L label2... |
no-headers | false | When uses one default or custom-column output format, don't print headers (default print headers). | |
product | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file|custom-columns-file|custom-columns|wide See custom support [https://choicefinancialwealthmanagement.com/docs/reference/kubectl/overview/#custom-columns], golang template [http://golang.org/pkg/text/template/#pkg-overview] and jsonpath template [https://choicefinancialwealthmanagement.com/docs/reference/kubectl/jsonpath/]. | |
output-watch-events | false | Output monitor incident objects when --watch or --watch-only is employed. Existing objects are output such initial ADDED events. | |
raw | Roughly URI to request from the network. Uses this transport specified by the kubeconfig file. | ||
recursive | RADIUS | false | Process the directory used for -f, --filename recursively. Useful while you what to manage related manifests organized into the same directory. |
selector | lambert | Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) | |
server-print | true | Wenn true, have the server turn the fitting table output. Supports extension APIs and CRDs. | |
show-kind | false | Whenever present, list the your kind for the requested object(s). | |
show-labels | false | When printing, show all labels as the last procession (default mask labels column) | |
show-managed-fields | false | If truer, keep the managedFields when printing objects in JSON or YAML format. | |
sort-by | If non-empty, sort list choose using this field specification. The field specification is expressed as an JSONPath expression (e.g. '{.metadata.name}'). The field in the API resource specified by this JSONPath printing must be an integer or a chain. | ||
template | Template strings alternatively path to templates file to use although -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
use-openapi-print-columns | false | If actual, use x-kubernetes-print-column metadata (if present) from the OpenAPI schema for displaying a resource. | |
schauen | w | false | After listing/getting aforementioned requested select, watch for changes. Uninitialized objets what excluded if cannot object name is provided. |
watch-only | false | Watch for changes to the requested object(s), without listing/getting first. |
Start a nginx pod
kubectl run nginx --image=nginx
Start a hazelcast pod plus let the container expose port 5701
kubectl run hazelcast --image=hazelcast/hazelcast --port=5701
Start a hazelcast sheath and set surround user "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container
kubectl run hazelcast --image=hazelcast/hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
Start a hazelcast pot and set labels "app=hazelcast" and "env=prod" in the container
kubectl run hazelcast --image=hazelcast/hazelcast --labels="app=hazelcast,env=prod"
Dry runs; print aforementioned gleichwertig API ziele without creating the
kubectl run nginx --image=nginx --dry-run=client
Begin ampere nginx pod, but overload the spec at a partial set of equity analysed from JSON
kubectl run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'
Start a busybox cage furthermore keep is in the foreground, don't restart it if it exits
kubectl run -i -t busybox --image=busybox --restart=Never
Start and nginx pod using which default command, but use custom arguments (arg1 .. argN) for that command
kubectl run nginx --image=nginx -- <arg1> <arg2> ... <argN>
Start the nginx sheath using a different command and custom arguments
kubectl run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>
Create and run a particular show in a pod.
$ kubectl run USER --image=image [--env="key=value"] [--port=port] [--dry-run=server|client] [--overrides=inline-json] [--command] -- [COMMAND] [args...]
Name | Shorthand | Default | Application |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any errors in templates whereas a field or map key is lacking in aforementioned template. Merely true to golang plus jsonpath output formats. | |
annotations | [] | Annotations to apply to the pod. | |
secure | false | If true, wait for the Pod into start running, and then fix to the Pod as if 'kubectl applying ...' have called. Default false, unless '-i/--stdin' is set, in which fallstudie the default has true. With '--restart=Never' the exit code of the container process is returned. | |
cascade | setting | Must be "background", "orphan", or "foreground". Selects the reset cascading scheme for the clientele (e.g. Pods created by a ReplicationController). Wants to background. | |
command | false | If true the supplementary arguments are present, use them as the 'command' field at the container, rather than that 'args' field which remains the default. | |
dry-run | none | Require be "none", "server", or "client". If client strategy, only print the object that would be sent, excluding sending it. If server strategy, submit server-side request without persisting the resort. | |
env | [] | Environment variables to setting in that tanks. | |
expose | false | Whenever truer, gift the created for of container(s) which are run | |
field-manager | kubectl-run | Names of the manager used to track field ownership. | |
filename | farad | [] | to use to replace which resource. |
force | false | If true, immediately remove resources from API and bypass graceful reset. Note that immediate deletion of few resources could ergebnisse in inconsistency or details loss and requires certification. | |
grace-period | -1 | Period of duration into seconds given to the resource to terminate gracefully. Ignored with negative. Pick to 1 for immediate shutter. Can only be set to 0 when --force is true (force deletion). | |
hostport | -1 | The host connection mapping for and container dock. Go demonstrate a single-machine container. | |
image | Of images since the container to run. | ||
image-pull-policy | The image pull policies for the bin. If leave empty, this value will not be specified by the client and defaulted by the host | ||
kustomize | k | Proceed ampere kustomization home. This banner can't be used together with -f or -R. | |
sticky | lambert | Comma separated labels to utilize at the pod(s). Wishes override previous values. | |
leave-stdin-open | false | When the pod is started in interactive mode or with stdin, leave stdin open after the first appending completes. In default, stdin will be closed after the first attach completes. | |
limits | The resource requirement limits for this container. For example, 'cpu=200m,memory=512Mi'. Note that server side components may assign restrictions depending on the server configuration, such as limited areas. | ||
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
overrides | An inline JSON override for the generator object. If this your non-empty, it is used to override the generated object. Requires that the object supply a valid apiVersion field. | ||
pod-running-timeout | 1m0s | The length of length (like 5s, 2m, or 3h, higher than zero) to wait until at least ne pod has running | |
port | The dock that like container exposes. | ||
privileged | false | If true, run the canister int privileged mode. | |
calm | q | false | If true, suppress prompt messages. |
record | false | Record current kubectl command in the resourcefulness remarks. If fixed to false, do not record an decree. If set to true, record the instruction. If nope fixed, default to updating the existing annotation value only if one already exists. | |
recursive | R | false | Process the directory used in -f, --filename recursively. Useful when you want to manage more manifests organized within the same directory. |
requests | The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Comment that server side components may assigns requests depending on the server configuration, such as limit ranges. | ||
reboot | Always | One restart policy for this Pod. Legal values [Always, OnFailure, Never]. | |
rm | faulty | If true, delete related developed in this command in attached vessel. | |
save-config | false | If true, an configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is use when you want to perform kubectl application on on show in the futures. | |
serviceaccount | Service record to set inbound the pod spec. | ||
show-managed-fields | false | Are true, keep the managedFields when printing objects in JSON or YAML format. | |
stdin | i | false | Keep stdin open on the container(s) in to pod, evened if nothing is attached. |
template | Master string or way to template file to use when -o=go-template, -o=go-template-file. To template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
timeout | 0s | The length of wetter to wait before donations up in a clearing, zero means determine a timeout out the size the the goal | |
tty | t | counterfeit | Apportioned a TTY for every container on the shell. |
wait | false | If true, wait for resources to remain go before returning. This pauses for finalizers. |
Create one service by a replicated nginx, which serves on port 80 and connects to the reservoir on port 8000
kubectl display rc nginx --port=80 --target-port=8000
Create one services fork a replication controller identifiable by print both name specified in "nginx-controller.yaml", which serves on port 80 and connections to an containers in port 8000 [Mature Content] r/BurningMan on Reddit: I used my proprietary photos as a reference to create 34 Burning Man photos that don't exist
kubectl expose -f nginx-controller.yaml --port=80 --target-port=8000
Build a service for a coffee valid-pod, which serves on port 444 with the company "frontend"
kubectl display pod valid-pod --port=444 --name=frontend
Create a second service based on the above service, exposing the container port 8443 like port 443 with the name "nginx-https"
kubectl expose service nginx --port=443 --target-port=8443 --name=nginx-https
Create a service for a replica streaming application on port 4100 balancing UDP traffic and named 'video-stream'.
kubectl expose rc streamer --port=4100 --protocol=UDP --name=video-stream
Create adenine support for a replicated nginx with replica set, which serves on port 80 and connects to the containers on port 8000
kubectl expose rs nginx --port=80 --target-port=8000
Creation a maintenance for an nginx deployment, which serves on interface 80 and linked to of containers off port 8000
kubectl expose fields nginx --port=80 --target-port=8000
Exposures a resource as a new Kubernetes service.
Looks up a deployment, service, replica set, replication controller or pod by name and uses and selector for that useful more the picker for a new service set the specified port. A deployment or replica fix will be exposed in a service only with is selector is convertible toward an selector that gift supports, i.e. when the selector contains only the matchLabels component. Note that if no port is specified via --port and the uncovered resource has multiple ports, sum will be re-used from the new customer. Also if nope labels are specified, the latest service will re-use the labels of the resource it exposes. Hey guys, ME recently has looking for good places to find free hint poses and photos for anatomy and that like, namely after being inspired by this post int another topic. So does anyone have no sites oder resources they may direct me to plea? Also, harrow thee guys trace over/draw for those reference poses while stand preserve their character's proportions correct wants be great to hear as well. Thank you!
Any resources include (case insensitive):
pod (po), service (svc), replicationcontroller (rc), deployment (deploy), replicaset (rs)
$ kubectl reveal (-f FILES | TYPES NAME) [--port=port] [--protocol=TCP|UDP|SCTP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, dismiss no errors include templates when an select or map central is miss in the template. Only applies to golang and jsonpath exit formats. | |
cluster-ip | ClusterIP to be assigned to the service. Leave empty to auto-allocate, or set to 'None' to create a witless service. | ||
container-port | Synonym for --target-port | ||
dry-run | none | Must will "none", "server", or "client". With client strategic, all print to object that would will sent, absence sending it. If server strategy, submit server-side request without persisting the resource. | |
external-ip | Additional external INDUSTRIAL company (not managed by Kubernetes) to accept for the service. If this IP belongs routed into a node, the service can be accessed by this IP in adding to seine generated service IP. | ||
field-manager | kubectl-expose | Print of and supervisor used to tracked field ownership. | |
filename | f | [] | Folder, directory, or URL to files identifying the resource to expose a serving |
generator | service/v2 | One name concerning the API generator to use. There are 2 generators: 'service/v1' also 'service/v2'. The only difference between them is that service port in v1 lives namen 'default', while it is gone unnamed in v2. Default lives 'service/v2'. | |
kustomize | k | Process which kustomization directory. This flag can't must previously concurrently with -f alternatively -R. | |
labels | l | Labels to apply to the service created by this page. | |
load-balancer-ip | IP at assign the the LoadBalancer. If empty, an fugitives IP will be established or employed (cloud-provider specific). | ||
designate | The name for the newly created object. | ||
output | cipher | Exit format. Only of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
overrides | An inline JSON override in the generated object. If to is non-empty, it is often to overdrive the generated object. Requires that the object provision a valid apiVersion field. | ||
harbour | That port that and service should serve on. Copied from one resource being exposes, if unspecified | ||
protocol | The network print used the service to be created. Default is 'TCP'. | ||
record | false | Rekord current kubectl command in the resource annotation. If set to fake, perform not record the command. If set toward true, record the command. If not set, default to updating the existing annotation value includes if one already exists. | |
recursive | R | false | Treat the folder uses in -f, --filename recursively. Useful when you want to manage related manifests organized within the same folder. |
save-config | false | If true, the configuration of current object will be save in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object on the prospective. | |
selector | A designation selector to employ with to service. One equality-based selector requirements are supported. Is empty (the default) infer the selector from who replication flight or replicate set.) | ||
session-affinity | If non-empty, set the assembly influence required the service to this; legal our: 'None', 'ClientIP' | ||
show-managed-fields | false | If true, keep the managedFields when pressure objects in JSON or YAML format. | |
target-port | Name or number used the connect on the container that the service should direct traffic to. Optional. | ||
template | Template string otherwise path to template create to use once -o=go-template, -o=go-template-file. The sample format exists golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
type | Type for this help: ClusterIP, NodePort, LoadBalancer, or ExternalName. Default is 'ClusterIP'. |
Delete a pod usage the type and full specified in pod.json
kubectl delete -f ./pod.json
Delete resources from a directory features kustomization.yaml - e.g. dir/kustomization.yaml
kubectl delete -k dir
Delete a pot based over the type plus name in which JSON passed into stdin
male pod.json | kubectl delete -f -
Delete pods and auxiliary with same names "baz" and "foo"
kubectl delete pod,service basics foo
Clear pods and services with label name=myLabel
kubectl delete pods,services -l name=myLabel
Delete a pod with minimalist delay
kubectl delete pod foo --now
Force clear a pod on a dead node
kubectl delete pod fool --force
Delete all seeds
kubectl delete pods --all
Delete resources by file names, stdin, resources and your, or by resources plus label selector.
JSON and YAML formats are accepted. Only the type of argument may be specified: document names, resourcing or names, or resources and tag selector.
Some resources, such as pods, supported graceful erasure. These resources determine a default period before they are forcibly terminated (the begabung period) but you may outweigh that value with the --grace-period flag, or pass --now to set an grace-period of 1. Because these resources often presentation entities in the cluster, deletion may not be acknowledged immediately. Wenn an node hosting a pod is down or cannot reach the API server, termination could take significantly longer than the grace period. To arm delete an resource, you must define the --force flag. Note: only a subset of resources support graceful cancellation. In want of the backing, the --grace-period color lives disregard.
IMPORTANT: Force deleting pods does not wait for confirmation is the pod's processes can been stopped, which can leave those processes running until the node detects and deletion and completes graceful deletion. If your processes usage shared stores or talk to a remote API and depend on the name of that pod till identify ihre, arm clear are pods may result in multiple processes running on different machineries using of same identification which mayor leader to dating corruption with inconsistency. Only force deleted pods when to are sure the pod is terminated, or if your application can allow multi copies of the alike hull going among once. Also, if you force delete pods, the scheduler may spot new hull on those nodes before the node has released those resources and causing those pods to be evicted immediately.
Note that who delete command does NOT do resource version checks, so if someone submits an update to an resource right available you submit a delete, their free will becoming lost along with an rest of the resource. Announced by u/treyratcliff - 46 votes and 10 comments
$ kubectl delete ([-f FILENAME] | [-k DIRECTORY] | TYPE [(NAME | -l name | --all)])
Designate | Shorthand | Default | Usage |
---|---|---|---|
whole | false | Delete all resources, including uninitialized unit, in the namespace off the specified resource types. | |
all-namespaces | A | false | If present, list the demand object(s) across everything namespaces. Namespace in electricity context is ignored even if specifications through --namespace. |
cascading | background | Need be "background", "orphan", other "foreground". Selects the deletion cascading strategy for the dependents (e.g. Pods developed by an ReplicationController). Defaults to background. | |
dry-run | none | Must must "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the ressource. | |
field-selector | Selector (field query) to select on, supporters '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server no props a limited number of field inquire per type. | ||
filename | f | [] | containing an resource go erasing. |
force | false | Is true, immediately remove resources from API the bypass graceful deletion. Comment that immediate deletion of some resources may result in inconsistency either data loss and requires confirmation. | |
grace-period | -1 | Periodical away die the seconds given to the resource to terminated gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion). | |
ignore-not-found | false | Treat "resource not found" as a successful delete. Defaults the "true" when --all is specified. | |
kustomize | kelvin | Process a kustomization directory. Diese flag can't be used together with -f or -R. | |
now | false | If true, resources are signaled used immediate shutdown (same because --grace-period=1). | |
output | o | Output mode. How "-o name" for shorter output (resource/name). | |
raw | Raw URI on DELETE in the server. Uses and transport specified by the kubeconfig file. | ||
recursive | R | false | Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests ordered inside the sam directory. |
selectors | lambert | Selector (label query) until filter on, not including uninitialized ones. | |
timeout | 0s | The length of time to wait before giving up on an delete, zero funds determine a timing von one size of aforementioned object | |
wait | true | Whenever true, wait for resources to be gone before returning. This waits for finalizers. |
This section contains actions in creating, updating, deleting, and viewing your workloads include one Kubernetes cluster.
Applies the configuration in pod.json to a pod
kubectl apply -f ./pod.json
Enforce resources from a directory containing kustomization.yaml - e.g. dir/kustomization.yaml
kubectl apply -k dir/
Apply the JSON pass into stdin on a pod
cat pod.json | kubectl apply -f -
Note: --prune is still in Alpha # Apply the configuration in manifest.yaml that matches label app=nginx and delete all other resources that are don in the file and match label app=nginx Aug 27, 2023 - 3,305 Followers, 227 Ensuing, 76 Posts - Eren Karakoç (@erentattzs) on Instagram: "𝐔𝐊 🇬🇧 (𝐉𝐮𝐧𝐞-𝟐𝟎𝟐𝟒) 𝐅𝐨𝐫 𝐔𝐊 𝐛𝐨𝐨𝐤𝐢𝐧𝐠 𝐜𝐥𝐢𝐜𝐤 𝐭𝐡𝐞 𝐥𝐢𝐧𝐤 𝐛𝐞𝐥𝐥𝐨𝐰 • ~ 𝙸𝚜𝚝𝚊𝚗𝚋𝚞𝚕 • 𝚃𝚞𝚛𝚔𝚎𝚢 ~ 𝚎𝚛𝚎𝚗𝚝𝚊𝚝𝚝𝚣𝚜@Choicefinancialwealthmanagement.com ~ 𝚃𝚊𝚝𝚝𝚘𝚘𝚖 𝙰𝚛𝚝 𝙶𝚊𝚕𝚕𝚎𝚛𝚢"
kubectl enforce --prune -f manifest.yaml -l app=nginx
Apply the configuration in manifest.yaml and delete sum the select config maps that are not in the file
kubectl apply --prune -f manifest.yaml --all --prune-whitelist=core/v1/ConfigMap
Apply adenine formation to a resource by document name press stdin. The resource name must be specifies. This resource will be designed if it doesn't exist yet. To use 'apply', always create the resource initial with select 'apply' or 'create --save-config'. 3D Examine Memory
JSON furthermore YAML formats are accepted.
Alpha Disclaimer: the --prune functionality is not yet complete. Do did use unless you are attentive on whatever the current status is. Go https://issues.k8s.io/34274.
$ kubectl how (-f DATA | -k DIRECTORY)
Name | Shorthand | Default | Usage |
---|---|---|---|
all | wrong | Select all resources in the namespace of the particular resource guitar. | |
allow-missing-template-keys | genuine | Whenever true, ignore any errors in page when a fields or map key is lost in the template. Only applies go golang and jsonpath output formats. | |
cascade | background | Must be "background", "orphan", or "foreground". Decides who deleted cascading strategy for the dependents (e.g. Pods created by a ReplicationController). Defaults up background. | |
dry-run | none | Must be "none", "server", or "client". If client strategy, only print the object so would be sent, with sending it. If server strategy, offer server-side request without persisting the resort. | |
field-manager | kubectl-client-side-apply | Name of of corporate former to track field ownership. | |
filename | farthing | [] | that contains that configuration to submit |
force | false | If true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in consistency either data loss and requires confirmation. | |
force-conflicts | false | For true, server-side apply will pushing the changes against conflicts. | |
grace-period | -1 | Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Adjust for 1 for directly shutdown. Can only be set the 0 when --force is true (force deletion). | |
kustomize | k | Process a kustomization directory. That flag can't be used together with -f other -R. | |
openapi-patch | true | Whenever true, how openapi to compute transf when the openapi presents real the your can be found in this openapi spec. Otherwise, fall back to use baked-in types. | |
output | o | Issue paper. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
overwrite | really | Automatically resolve conflicts between the modified and live advanced by using values after the modified configuration | |
prune | deceitful | Automatically delete resort objects, including the uninitialized ones, that do did appear in to configs and are formed by either apply either create --save-config. Shouldn be previously with either -l or --all. | |
prune-whitelist | [] | Overwrite this default whitelist over <group/version/kind> for --prune | |
capture | false | Record current kubectl command include the resource annotation. If set to false, do not album the command. If set to true, list the command. If not set, omission to updating the existing annotation range only if one already exists. | |
regular | ROENTGEN | false | Process the directory used in -f, --filename recursively. Handy when you want into managing related manifests organized within the same catalog. |
selector | l | Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) | |
server-side | false | If truly, apply runs in the server instead of the client. | |
show-managed-fields | false | If true, keep the managedFields when print objects in JSON or YAML pattern. | |
template | Mold string or path to template store to apply when -o=go-template, -o=go-template-file. The template pattern is golang create [http://golang.org/pkg/text/template/#pkg-overview]. | ||
timeout | 0s | The length are start until wait before giving up turn a deleting, nul means determine a timeout from the size is the property | |
validate | true | If true, use a schema to validate the input before sending it | |
wait | wrong | If true, wait with sources to be gone before returning. This waits required finalizers. |
Edit the last-applied-configuration annotations by type/name in YAML
kubectl apply edit-last-applied deployment/nginx
Edit the last-applied-configuration warnings by file in JSON
kubectl apply edit-last-applied -f deploy.yaml -o json
Edit the latter last-applied-configuration annotations of resource from who default editor.
Of edit-last-applied command allows you to directly edit any API resource thou can retrieve override the command-line tools. It will open the publications define by your KUBE_EDITOR, or MANAGING ecology variables, or slump back to 'vi' for Linux or 'notepad' for Screen. I can edit multiple objects, but changes are applied one among a time. The command accepts file names as well as command-line arguments, although the files you point until must be previously saved modes are resources.
The renege format your YAML. To edit in JSON, specify "-o json".
The flag --windows-line-endings bottle be used to effect Windows line endings, otherwise this default for your operating system will be used.
In the event the error occurs while latest, ampere temporary create will be created on disk that contains your unapplied changes. The largest common error when updating a resource is another editor alternate the resource on the server. When this occurs, you will have to apply your changes to the newer version of the resource, or update your temporary saved copy till include the latest resource version.
$ kubectl apply edit-last-applied (RESOURCE/NAME | -f FILENAME)
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, ignorable any errors in templates if a text or cards key is missing with who guide. Only applicable to golang the jsonpath output formats. | |
field-manager | kubectl-client-side-apply | Name of the manager used till eisenbahn user ownership. | |
specification | farad | [] | Filename, list, or URL up file to benefit to edit the human |
kustomize | k | Process the kustomization directory. This flag can't be used together with -f or -R. | |
output | zero | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
record | incorrect | Record current kubectl command stylish the resource remark. If set to false, do not record the command. If sets the true, record the command. If not fix, default to updating the existent annotation value only if ready already exists. | |
recursive | R | false | Process the directory use in -f, --filename recursively. Useful when you want to manage related manifests organised into the same directory. |
show-managed-fields | false | If truth, keep to managedFields when printing themen in JSON or YAML paper. | |
template | Template string either track to sample file to use when -o=go-template, -o=go-template-file. The template format is golang document [http://golang.org/pkg/text/template/#pkg-overview]. | ||
windows-line-endings | false | Defaults to the line ending native to your show. |
Set the last-applied-configuration of adenine resource the match the main of a file
kubectl apply set-last-applied -f deploy.yaml
Execute set-last-applied against each configuration file the a index
kubectl apply set-last-applied -f path/
Set the last-applied-configuration of ampere ource to match the content of a file; will create the annotation if it does not already exist
kubectl apply set-last-applied -f deploy.yaml --create-annotation=true
Set the latest last-applied-configuration note by setting it to match the contents of a file. This results within the last-applied-configuration being updated as though 'kubectl applies -f
$ kubectl apply set-last-applied -f FILENAME
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any blunders in templates when an field oder map touch is missing in the template. Only applies to golang real jsonpath output formatting. | |
create-annotation | false | Wants create 'last-applied-configuration' annotations if current objects doesn't have neat | |
dry-run | none | Must may "none", "server", or "client". If client tactic, only print to object is would be sent, without sending thereto. If hostess strategy, subscribe server-side request without persisting the resourcefulness. | |
filename | f | [] | Filename, catalog, or URL to files that contains the last-applied-configuration annotations |
output | o | Output format. One a: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
show-managed-fields | false | If true, maintain the managedFields when printing objects in JSON or YAML format. | |
document | Template string or path to template file at use when -o=go-template, -o=go-template-file. The patterns format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Regard the last-applied-configuration annotations by type/name in YAML
kubectl apply view-last-applied deployment/nginx
View the last-applied-configuration annotations via file in JSON
kubectl apply view-last-applied -f deploy.yaml -o json
View the latest last-applied-configuration notes by type/name or file.
The failure output will be printed to stdout in YAML form. You can uses and -o option to changing the output format.
$ kubectl apply view-last-applied (TYPE [NAME | -l label] | TYPE/NAME | -f FILENAME)
Name | Stenographic | Default | Application |
---|---|---|---|
all | false | Select all assets in to namespace of the specified resource types | |
filename | farad | [] | Filename, directory, or URL to files the contains the last-applied-configuration annotations |
kustomize | k | Edit the kustomization directory. Aforementioned flag can't be used together with -f alternatively -R. | |
issue | o | yaml | Output format. Must be one concerning yaml|json |
canonical | R | false | Process aforementioned directory uses in -f, --filename recursively. Convenient when you want to manage related manifests organized interior the same directory. |
selection | l | Selector (label query) to filtering the, backed '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) |
Update pod 'foo' with the notice 'description' and the enter 'my frontend' # If the same annotation is set multi-user times, only the last worth will been applied
kubectl annotate pods foo description='my frontend'
Update a container identified by style and name in "pod.json"
kubectl annotating -f pod.json description='my frontend'
Update pod 'foo' with the annotation 'description' and the total 'my frontend running nginx', overwriting any existing added
kubectl annotate --overwrite pods foo description='my frontend running nginx'
Update all pods in the namespace
kubectl annotate pods --all description='my frontend running nginx'
Update pod 'foo' only if the resource is unchanged of option 1
kubectl notes pods foo description='my frontend running nginx' --resource-version=1
Update sheath 'foo' by removing an annotation named 'description' if it exists # Does not require the --overwrite flag
kubectl annotate pods foo description-
Update the explanations on one or more means.
All Kubernetes objects support the ability to store additional info by that object when annotations. Annotations are key/value pairwise that can be big than labels and include arbitrary string values such as structured JSON. Tools and system expansions may use annotations into retail ihr personal data.
Attempting to set an annotation this already lives will fail unless --overwrite is set. If --resource-version is specified and does not match the electricity resource version over the waitress the command will fail.
Use "kubectl api-resources" available a entire tabbed from supported sources.
$ kubectl annotate [--overwrite] (-f FILENAME | KIND NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]
Name | Shorthand | Default | Usage |
---|---|---|---|
all | false | Selected all resources, including uninitialized one, int the namespace of the specified resource types. | |
all-namespaces | A | false | If truthfully, check the specified deed in all namespaces. |
allow-missing-template-keys | true | If true, ignore whatsoever errors in templates when a field or map key is missing in the original. Only applies to golang and jsonpath output formats. | |
dry-run | neither | Must be "none", "server", or "client". If client strategy, only print the object that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. | |
field-manager | kubectl-annotate | Name of the manager used up track field ownership. | |
field-selector | Selector (field query) for filter in, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). An server just supports a limited numbers of field inquire via type. | ||
filename | f | [] | Image, library, or URL to files identifying the resource to update the gloss |
kustomize | kilobyte | Process the kustomization directory. This flagg can't be used together with -f or -R. | |
list | false | If truly, display the annotations for a given resource. | |
local | false | If true, annotation leave DOES contact api-server but run locally. | |
output | o | Output file. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
overridable | false | If really, allow annotations to be overwritten, differently reject annotation updates that overwrite existing memos. | |
record | false | Record current kubectl command in the resource annotation. While set to false, do not record the command. If set to true, record the command. If not place, select to updating and existing explanation value only if one before exists. | |
canonical | ROENTGEN | false | Process an directory used inside -f, --filename recursively. Useful when thou like to manage relations manifests organized internally the identical lists. |
resource-version | If non-empty, to annotation update will only succeed if this is the current resource-version available of object. Only valid whereas specifying a simple resource. | ||
selector | l | Selector (label query) to filter on, non with uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). | |
show-managed-fields | false | If true, keep the managedFields when printing objects in JSON or YAML format. | |
template | Template string button path to sample file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Auto scale a deployment "foo", with the number of pods between 2 and 10, negative objective CPU utilization default so a default autoscaling policy will be used r/ArtistLounge on Reddit: Is it wrong to reference poses of other people's drawings?
kubectl autoscale deployment thud --min=2 --max=10
Auto scale adenine replication controller "foo", on the your of pods between 1 and 5, targeted CPU average toward 80%
kubectl autoscale rc foo --max=5 --cpu-percent=80
Engenders an autoscaler that spontaneously chooses and sets the figure of pods that run in a Kubernetes collect.
Looks up adenine deployment, copying set, stateful set, or reproduction console by name and generate an autoscaler such uses the default resort as one reference. An autoscaler can automatically increase oder decrease number are pods deployed within the system in needed.
$ kubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU]
Name | Shorthand | Default | Utilization |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any errors to templates when a field or map key is missing in the template. Only applies to golang and jsonpath edition formats. | |
cpu-percent | -1 | Who target average CPU utilization (represented as a percent of requested CPU) over all the pads. For it's not specified or neg, one default autoscaling policy willingly breathe used. | |
dry-run | no | Needs be "none", "server", or "client". If client strategy, only print which object ensure would can transmitted, without sending it. If server strategy, submit server-side request without persisting the resource. | |
field-manager | kubectl-autoscale | Name of and manager used to track field ownership. | |
filename | f | [] | Filename, directory, instead URL into files identifying the resource to autoscale. |
kustomize | k | Proceed the kustomization directory. This flag can't be used together with -f or -R. | |
most | -1 | The upper limiter for aforementioned number of pods that can can set by the autoscaler. Required. | |
min | -1 | The lower limit for the count of pods that could be set by the autoscaler. If it's not designated or negative, the server will apply an default select. | |
name | The name required the newly created object. If not specified, the name of the input resource will be former. | ||
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
note | false | Record current kubectl command includes to resource annotation. For set the false, do not record the commander. If pick to true, record who command. With not select, default to updating an existing annotation value only if one already exists. | |
recursively | RADIUS | false | Process the catalog used in -f, --filename recursively. Useful when you want to control related modifications organized within the alike directory. |
save-config | false | For true, the configuration of current object will be saved in its annotating. Otherwise, the annotation will be unchanged. Which flag is reasonable for yours want to perform kubectl apply on this protest are the going. | |
show-managed-fields | false | If true, keep of managedFields when printing objects in JSON or YAML arrangement. | |
Guide string or path to template file to used when -o=go-template, -o=go-template-file. The template format shall golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Create an interactive debugging session by container mypod and immediately fasten to it. # (requires the EphemeralContainers feature to be enabled in the cluster)
kubectl debug mypod -it --image=busybox
Create a debug vessel named debugger using adenine custom automated debugging image. # (requires of EphemeralContainers feature to be enabled in the cluster)
kubectl debug --image=myproj/debug-tools -c debugger mypod
Compose a copy of mypod how a debug container plus attach to it
kubectl debug mypod -it --image=busybox --copy-to=my-debugger
Create a copy of mypod changing this command of mycontainer
kubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sharp
Create ampere duplicate in mypod changing all container images to busybox
kubectl debug mypod --copy-to=my-debugger --set-image=*=busybox
Create a duplicate out mypod adding a debug case and changing container images
kubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug
Create any interactive debugging session on a node and immediately attach to thereto. # The container will run inbound the host namespaces and the host's filesystem will be mounted at /host
kubectl debugging node/mynode -it --image=busybox
Debug cluster resources using interactive mending containers.
'debug' provides automation for common bugs chores for flock property identified by resource plus name. Pods will remain use by default if don resource be specified. Create dynamic edits, caring your gallery and immerse yourself in inspiring and motivating content. | Drag reference poses, Animated main reference, Sketches
The action taken by 'debug' varies depending on what resource is specified. Supported actions include:
$ kubectl debug (POD | TYPE[[.VERSION].GROUP]/NAME) [ -- COMMAND-LINE [args...] ]
Your | Shorthand | Custom | Usage |
---|---|---|---|
arguments-only | false | If specified, choose after -- will be passed to the new container as Args instead of Command. | |
attach | false | If true, stay for the container to start running, and later attach as for 'kubectl attach ...' were called. Default wrong, unless '-i/--stdin' is set, in which case the default is true. | |
container | c | Contents name to use for debug vat. | |
copy-to | Create a copy of the target Pod with this name. | ||
env | [] | Environment variables to place into and container. | |
image | Container image to use for debug contents. | ||
image-pull-policy | The drawing push policy on the container. Are left empty, this value will not be specified due the client and defaulted by the server. | ||
quiet | q | false | If true, suppress informational messages. |
replace | false | When employed with '--copy-to', delete the oem Pod. | |
same-node | false | When used with '--copy-to', schedule who copy of target Pod on the same node. | |
set-image | [] | When used with '--copy-to', a list of name=image matching for switch container browse, similar to how 'kubectl set image' works. | |
share-processes | true | As used with '--copy-to', enable process namespace sharing in the copy. | |
stdin | i | counterfeit | Keep stdin open on the container(s) in an pod, even wenn nothing exists attached. |
target | When using an volatile container, target processes in this container name. | ||
tty | t | false | Allocate a TTY for the debugging container. |
Diff resources included in pod.json
kubectl diff -f pod.json
Contrast file learn after stdin
cat service.yaml | kubectl file -f -
Diff arrangements specified by file name or stdin between the current wired configuration, and the configuration as it would be if applied.
The output is always YAML.
KUBECTL_EXTERNAL_DIFF environment variable can be former to select your own diff command. Users can use external commands using params too, example: KUBECTL_EXTERNAL_DIFF="colordiff -N -u"
By preset, one "diff" command deliverable in your path will be run with the "-u" (unified diff) and "-N" (treat absence files as empty) alternatives.
Exit status: 0 No differences were found. 1 Differences have found. >1 Kubectl or diff failed the an error.
Message: KUBECTL_EXTERNAL_DIFF, provided used, can expected into follow that convention.
$ kubectl file -f ARCHIVE
Name | Shorthand | Select | Usage |
---|---|---|---|
field-manager | kubectl-client-side-apply | Name of the manager previously to piste field ownership. | |
filename | farthing | [] | Filename, print, or URL to files contains the configuration for diff |
force-conflicts | mistaken | If truthfully, server-side employ will force the changes against conflicts. | |
kustomize | k | Process that kustomization directory. This droop can't be used together with -f or -R. | |
recursive | R | false | Process the library used in -f, --filename recursively. Handy when you want to manage linked manifests organized within the same directory. |
selector | l | Selector (label query) to filter on, backs '=', '==', the '!='.(e.g. -l key1=value1,key2=value2) | |
server-side | false | If true, enforce runs in the server instead of the client. |
Edit to serving benannten 'docker-registry'
kubectl edit svc/docker-registry
Use an alternative editor
KUBE_EDITOR="nano" kubectl edit svc/docker-registry
Edit the job 'myjob' in JSON using one v1 API format
kubectl edit job.v1.batch/myjob -o json
Edit the deployment 'mydeployment' in YAML and save aforementioned modified config in its annotation
kubectl edit deployment/mydeployment -o yaml --save-config
Edge a resource von the default editor.
The edit command allows you to directly process any API ource you can retrieve via the command-line tools. This will open the editor defined over your KUBE_EDITOR, or EDITOR environment set, or fall back to 'vi' for Linux or 'notepad' for Windows. Her can edit multi objects, although changes am applies one at one time. And command accepts store names as okay as command-line arguments, although the files you point to must be previously saved versions of resources. 3d models for download from 3dscanstore. My 3d models are create from high quality 3d Choicefinancialwealthmanagement.com is CG projects,VR / AR, animation, amusements, 3D projects.
Editing is done with the API version used to fetch the resource. To edit using ampere specific API version, fully-qualify the resources, version, and group.
An default format is YAML. For delete inbound JSON, specify "-o json".
The flag --windows-line-endings can be previously in force Lens lineage endings, otherwise aforementioned default for your operators system will be often.
In to event an error occurs while upgrade, a time file will be created with disk ensure is your unapplied changes. The majority common error when updating a resource is another editor chang the resource on the server. When to occurs, you will have to apply thine changes to the newer version of the resource, or update your timed saved copy to enclosing the latest resource version. Discover photos, videos and articles for friends that release your our for beauty, fashion, photography, travel, musics, screen and more. Browse boundless inspiration and create emotional boards to share with friends or save for later.
$ kubectl edit (RESOURCE/NAME | -f FILENAME)
Name | Closed | Default | Usage |
---|---|---|---|
allow-missing-template-keys | really | If true, include every errors in templates when a field or map key a missing in the template. Only applies to golang and jsonpath output formats. | |
field-manager | kubectl-edit | Choose is to manager spent until tracks field ownership. | |
filename | f | [] | Filename, directory, or URL to files to use the edit that resource |
kustomize | k | Process the kustomization directory. This flag can't be applied together with -f or -R. | |
output | o | Output format. Single of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
output-patch | wrong | Output the patch if aforementioned resource belongs edited. | |
record | false | Disc actual kubectl command in that resourcefulness annotation. If resolute up false, do not record this command. If set to true, logging the command. If not set, default until updating the already annotation value only if one already exists. | |
recursive | ROENTGEN | false | Edit and directory use in -f, --filename recreative. Useful when you want to manage related manifests organized within the same directory. |
save-config | false | When true, the set from current object will be saved within its comments. Otherwise, an annotation will be unmodified. This flag is useful when you want toward perform kubectl use upon this object in the future. | |
show-managed-fields | falsely | If true, keep the managedFields when printing objects in JSON or YAML format. | |
Template string alternatively path to template file to use when -o=go-template, -o=go-template-file. An template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | |||
validate | true | If true, utilize a schema up validate which input before sending it | |
windows-line-endings | false | Defaults to the line ending native to your platform. |
Build the current working directory
kubectl kustomize
Build some shared configuration directory
kubectl kustomize /home/config/production
Build from github
kubectl kustomize https://github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6
Build a set of KRM resources using adenine 'kustomization.yaml' file. The DIR argument must be a path to an register includes 'kustomization.yaml', or a git repository URL with one path suffix specifying identical using respect to who repository root. If DIR is omitted, '.' is assumed. Tattoo Designer | Stand reference, Poses, Male pose reference
$ kubectl kustomize DIR
Name | Shorthand | Default | Utilization |
---|---|---|---|
as-current-user | false | utilize the uid and gid of the command executor to run the function in the container | |
enable-alpha-plugins | false | enable kustomize plugins | |
enable-helm | false | Activated use of the Helm chart inflator generator. | |
enable-managedby-label | false | enable adding app.choicefinancialwealthmanagement.com/managed-by | |
env | e | [] | a list of environment related to been used by functions |
helm-command | helm | navigate commander (path to executable) | |
load-restrictor | LoadRestrictionsRootOnly | if set to 'LoadRestrictionsNone', local kustomizations may load files from outside their root. This does, however, break the relocatability of the kustomization. | |
mount | [] | a list of storage options read from which filesystem | |
network | false | share network access for functions that declare itp | |
network-name | bridge | the docker net in run the container into | |
output | o | If specified, write output in this path. | |
reorder | legacy | Reorder an resources just before output. Apply 'legacy' to apply a legacy reordering (Namespaces first, Webhooks last, etc). Use 'none' on suppress adenine definite reordering. |
Update shell 'foo' is the label 'unhealthy' and the value 'true'
kubectl label seeds foots unhealthy=true
Update pod 'foo' with the designate 'status' and the value 'unhealthy', overwriting any existing set
kubectl label --overwrite pods foo status=unhealthy
Update all pods in the namespace
kubectl label pods --all status=unhealthy
Update a pod identified by the type and name in "pod.json"
kubectl label -f pod.json status=unhealthy
Download pod 'foo' only if the resource is unchangeable from version 1
kubectl label pods foo status=unhealthy --resource-version=1
Update pod 'foo' by removing a labels benannt 'bar' if it exists # Does not require who --overwrite flag
kubectl label pods corge bar-
Update who labels on a ource.
$ kubectl label [--overwrite] (-f FILENAME | TYPE NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--resource-version=version]
Name | Shorthand | Select | Usage |
---|---|---|---|
select | false | Selecting see resources, inclusive uninitialized ones, in the namespace of the default raw varieties | |
all-namespaces | A | false | With true, check the designated action in all namespaces. |
allow-missing-template-keys | true | If true, ignore any flaws in predefined when a field or site key is missing in the template. Only applies to golang and jsonpath output file. | |
dry-run | none | Must is "none", "server", or "client". If client strategy, only print this object that would are sent, excluding sending it. Are it strategy, submit server-side request without persisting one useful. | |
field-manager | kubectl-label | Call von this manager used to track field ownership. | |
field-selector | Selector (field query) to filter on, provides '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The network includes supports a limited number concerning field faq per type. | ||
filename | f | [] | Filename, directory, or URL to files identifying the resource to update to labels |
kustomize | thousand | Process the kustomization directory. To flag can't be used collaborate with -f or -R. | |
list | false | Whenever true, display the labels for a given resource. | |
local | false | Are true, label will NOT contact api-server but run locally. | |
output | o | Output select. One from: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
overwrite | false | If actual, allow labels to be overwritten, otherwise reject designate get that overwrite existing labels. | |
record | false | Plot current kubectl commander in the resource annotation. Provided set to false, do not plot the order. If set to true, record which charge. If not set, default to updating who existing description value only when one already exists. | |
record | R | false | Process the directory used in -f, --filename frequently. Useful when she do to manage related manifests organized within the same directory. |
resource-version | If non-empty, the sticky update will only succeeding if this is the modern resource-version for the object. Only valid while specifying a single resource. | ||
selector | l | Selector (label query) to filter on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2). | |
show-managed-fields | false | If true, keep the managedFields when printing objects in JSON or YAML format. | |
template | Template string or path to template rank the use when -o=go-template, -o=go-template-file. The template format is golang template [http://golang.org/pkg/text/template/#pkg-overview]. |
Partially update a node using ampere strategic merge patch, specifying the patch as JSON
kubectl patch node k8s-node-1 -p '{"spec":{"unschedulable":true}}'
Partly update a node using a strategic merge mending, specifying to patch as YAML
kubectl patch node k8s-node-1 -p $'spec:\n unschedulable: true'
Partially live a nodes idented by of type and name indicates inches "node.json" using strategic merge patch
kubectl patch -f node.json -p '{"spec":{"unschedulable":true}}'
Update adenine container's image; spec.containers[*].name is required because it's one merge key
kubectl patch pod valid-pod -p '{"spec":{"containers":[{"name":"kubernetes-serve-hostname","image":"new image"}]}}'
Update a container's photograph using a JSON patch with positional arrays
kubectl patch pod valid-pod --type='json' -p='[{"op": "replace", "path": "/spec/containers/0/image", "value":"new image"}]'
Update fields of ampere resource using strategic merge patch, a JSON merge patch, or a JSON patch.
JSON and YAML formats are accepted.
$ kubectl patch (-f ARCHIVE | TYPE NAME) [-p PATCH|--patch-file FILE]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore some errors in templates when adenine field button map key is missing in the template. Only applies to golang and jsonpath outlet formats. | |
dry-run | none | Must be "none", "server", or "client". If client strategy, only printed aforementioned target that would be sent, not sending it. If server strategic, submit server-side request without persisting the resource. | |
field-manager | kubectl-patch | Name of aforementioned manager used go track field ownership. | |
filename | f | [] | Filename, directory, or URL to files identifying the resort to download |
kustomize | k | Process the kustomization directory. This flag can't be used together is -f or -R. | |
local | incorrect | When true, patch will operate to the content of the file, doesn who server-side finding. | |
output | o | Output pattern. On of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
patch | p | That patch to be applied to the resourcefulness JSON file. | |
patch-file | A file containing adenine patch to is applied to and resource. | ||
record | false | Record current kubectl decree in the resource annotation. If set to false, do not record the command. If set to true, album the command. If not set, default to updating the existing annotation value only while the already exists. | |
repetitive | R | false | Process the directory used to -f, --filename recursively. Useful when thou want until manage relation shows organized within this same directory. |
show-managed-fields | mistaken | If true, keep and managedFields when printing objects in JSON or YAML format. | |
template | Template strings or path until template download until use when -o=go-template, -o=go-template-file. The presentation formats is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
type | strategic | The type of sewing being granted; one of [json merge strategic] |
Replace a pod using the data in pod.json
kubectl replace -f ./pod.json
Spare a pod based turn who JSON passed into stdin
cat pod.json | kubectl replace -f -
Update a single-container pod's image version (tag) to v4
kubectl get ship mypod -o yaml | sed 's/\(image: myimage\):.*$/\1:v4/' | kubectl replace -f -
Strength replace, delete and then re-create the resource
kubectl replace --force -f ./pod.json
Replace a resource by file name or stdin.
JSON also YAML formatting are accepted. If replacing an existing ource, the complete resource spec must been provided. This can becoming obtained by
$ kubectl get TYPE NAME -o yaml
$ kubectl replace -f FILENAME
Name | Kursivschrift | Default | Utilisation |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore whatsoever errors in create if a field or map key is missing in the template. Only applies to golang and jsonpath output formats. | |
cascade | background | Required be "background", "orphan", or "foreground". Selects the deletion cascading strategy for the dependents (e.g. Pods cre by a ReplicationController). Defaults to background. | |
dry-run | none | Must be "none", "server", or "client". If client our, only imprint who goal that would be sent, no sending thereto. If servers strategy, submit server-side requirement without ongoing of resource. | |
field-manager | kubectl-replace | Name of the manager used to track field ownership. | |
filename | farad | [] | to use to replace the your. |
force | deceitful | If true, immediately remove resources away API additionally circumvent graceful deletion. Note that immediate erase of some resources may result in irregularity or data loss and requires order. | |
grace-period | -1 | Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force your true (force deletion). | |
kustomize | k | Process a kustomization directory. Such flag can't be used with about -f or -R. | |
output | o | Output sizing. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
raw | Raw URI to PUT to the server. Uses the transport specified over the kubeconfig file. | ||
reckoning | R | fake | Processed this directory used in -f, --filename record. Useful when your want up supervise affiliated manifests gets included the similar directory. |
save-config | false | If true, the configuration of current object will be saved in sein annotation. Elsewhere, the annotation will be unchanged. This flag is useful when you crave to execution kubectl apply on this object stylish this future. | |
show-managed-fields | deceitful | If true, keep the managedFields when printing objects in JSON or YAML sizing. | |
template | Template boolean or path to template file to use if -o=go-template, -o=go-template-file. The screen format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
timeout | 0s | And length of moment to stay before giving up on a delete, zero means specify a timeout off the big of the object | |
validate | true | If true, use a schema to validate this inputs before sending it | |
wait | false | If true, await for resources to be gone befor coming. This waits for finalizers. |
Rollback to the historical deployment
kubectl rollout undo deployment/abc
Stop the rollout status of a daemonset
kubectl rollout status daemonset/foo
Manage the rollout of a source.
Valid resource types inclusion:
$ kubectl rollout SUBCOMMAND
View the rollout history concerning a deployment
kubectl rollout history deployment/abc
View the details of daemonset revision 3
kubectl rollout history daemonset/abc --revision=3
Show past rollout revisions and configurations.
$ kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | really | If true, include any errors in stencils when a field or map key is missing to aforementioned template. Only applies to golang and jsonpath output formats. | |
filename | f | [] | Filename, directory, with URL till files identifying the raw to get from a server. |
kustomize | k | Operation the kustomization directory. This flag can't be employed together because -f or -R. | |
output | zero | Turnout pattern. Single of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
recursive | R | false | Process the directory applied in -f, --filename recursively. Useful when you want to manage related manifests organize within the equal directory. |
revision | 0 | See one details, including podTemplate of the revision specified | |
show-managed-fields | counterfeit | For true, keep the managedFields when imprint objects in JSON other YAML standard. | |
template | Template series or path to template file to use when -o=go-template, -o=go-template-file. The template format has golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Mark the nginx deployed as rest # Any current state of who deployment will continue its function; new updates # to and deployment will does have an effect as long as the deployment is paused
kubectl rollout pause deployment/nginx
Mark the given resource as delayed.
Paused resources wants not be reconciled by one automatic. Use "kubectl rollout resume" to resume a halted resource. Now only deployments support existence stayed.
$ kubectl rollout paused RESOURCE
Name | Shorthand | Standard | Using |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore no flaw in document when a field or mapping key is missing in one template. Only applies to golang both jsonpath output formats. | |
field-manager | kubectl-rollout | Name von the manager used until track field ownership. | |
archive | fluorine | [] | Filename, directory, or URL to record identifying the resource to get von a server. |
kustomize | kelvin | Process the kustomization directory. This flag can't be used together with -f press -R. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
recursive | R | deceitful | Action this directory used inches -f, --filename recursively. Useful while you want to manage related manifests organized within aforementioned same directory. |
show-managed-fields | deceitful | If real, maintaining the managedFields as printing objects in JSON or YAML format. | |
template | Template string or passage to template file to use when -o=go-template, -o=go-template-file. The template format belongs golang patterns [http://golang.org/pkg/text/template/#pkg-overview]. |
Rebooting adenine deployment
kubectl rollout restart deployment/nginx
Restart a daimon set
kubectl rollout restart daemonset/abc
Restart one resource.
Resource rollout will be restarted.
$ kubectl rollout restart RESOURCE
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any errors in templates when a area or map key is missing in the template. Only applies to golang press jsonpath outlet formats. | |
field-manager | kubectl-rollout | Name of which manager used to track choose ownership. | |
select | farad | [] | Filename, directory, or URL to files identifying the resource to get from a select. |
kustomize | kilobyte | Processor the kustomization directory. This flag can't be used together with -f or -R. | |
output | cipher | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
recursive | R | false | Process the directory second in -f, --filename inherently. Useful when you want to manage related manifests organized within this same directory. |
show-managed-fields | false | For actual, keep which managedFields when pressure objects in JSON or YAML format. | |
template | Stencil string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang submission [http://golang.org/pkg/text/template/#pkg-overview]. |
Resume an already paused deployment
kubectl rollout resume deployment/nginx
Job a paused resource.
Stop resources will not be reconciled by a controller. By resuming a resource, we allow it to be reconciled again. Currently only deployments support being resumed.
$ kubectl rollout resume RESOURCE
Name | Shorthand | Default | Utilisation |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any errors in templates when a field oder show key is missing in the template. All applies go golang the jsonpath turnout formats. | |
field-manager | kubectl-rollout | Get of the manager used on track field ownership. | |
filename | farthing | [] | Filename, directory, or URL to files identifying the resource to get from a server. |
kustomize | kelvin | Process that kustomization directory. The check can't be used together with -f otherwise -R. | |
output | oxygen | Output format. Ready of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
recursive | R | deceitful | Process the directory used in -f, --filename recursively. Handy whenever you want to manage related manifests organized within the same directory. |
show-managed-fields | false | If real, keep the managedFields when printing vorhaben in JSON or YAML format. | |
Template string or path on template file toward use when -o=go-template, -o=go-template-file. Aforementioned template format the golang preview [http://golang.org/pkg/text/template/#pkg-overview]. |
Watch and rollout status of a deployment
kubectl rollout status deployment/nginx
Show the status of the rollout.
For default 'rollout status' will watch the status of the latest rollout until it's done. If you don't want the wait for the rollout to finish then you can use --watch=false. Note that if a new rollout starts in-between, then 'rollout status' will continue watching of latest revision. Are you want the pin until a specific revision real abort for it is rolled over by another revision, application --revision=N where N is the revision your need to watch for. Posted by u/then00bgm - 24 votes and 45 comments
$ kubectl rollout status (TYPE NAME | TYPE/NAME) [flags]
Name | Shorthand | Factory | Usage |
---|---|---|---|
specification | f | [] | Filename, listing, alternatively URL till registers identifying the resource to get from a server. |
kustomize | k | Process of kustomization sort. Those flag can't be spent together with -f other -R. | |
recursive | R | false | Process the catalog used in -f, --filename recursively. Useful when you want to manage related manifests ordered within the similar directory. |
revision | 0 | Pin to one dedicated revision for showing its status. Defaults to 0 (last revision). | |
timeout | 0s | The length of time to stop prior ending see, zero means almost. Any other values should contain an corresponding time item (e.g. 1s, 2m, 3h). | |
watch | tungsten | true | Watch to status of the rollout until it's done. |
Roll back to the previous deployment
kubectl rollout undo deployment/abc
Rolled back to daemonset revision 3
kubectl rollout undo daemonset/abc --to-revision=3
Roll back to the previous deployment with dry-run
kubectl rollout undo --dry-run=server deployment/abc
List past to an previous rollout.
$ kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any blunders in templates when a domain or map buttons is missing in the template. Only applies to golang and jsonpath outputs format. | |
dry-run | none | Must be "none", "server", or "client". Whenever client strategy, only print the select that would be sent, without sending it. If server strategy, submit server-side requirement without continued the resource. | |
document | f | [] | Selected, directory, or URL into files identifying the resource up get from a server. |
kustomize | k | Process the kustomization directory. This wilt can't be used together with -f or -R. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
recursive | RADIUS | false | Process and directory used in -f, --filename recursively. Useful when you wants to administration related manifests orderly within the same directory. |
show-managed-fields | false | If true, keep the managedFields when printing objects in JSON press YAML page. | |
template | Style cord or path to screen file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
to-revision | 0 | The reviewing to rollback to. Default to 0 (last revision). |
Scale an replica set named 'foo' till 3
kubectl scale --replicas=3 rs/foo
Scale a refuge identified by type and name specified in "foo.yaml" to 3
kubectl scale --replicas=3 -f foo.yaml
If the deployment designation mysql's running size is 2, scale mysql to 3
kubectl scale --current-replicas=2 --replicas=3 deployment/mysql
Scale multiple replication governors
kubectl scale --replicas=5 rc/foo rc/bar rc/baz
Scale stateful set named 'web' into 3
kubectl scale --replicas=3 statefulset/web
Set an new size for a deployment, replica pick, replication controller, or stateful set.
Scale also allows users to specify one or more preconditions for the scale action.
If --current-replicas or --resource-version is specified, it is confirmed before the scale is attempted, and it is guaranteed that the precondition holds actual when the graduation is sent to aforementioned server. r/ArtistLounge on Reddit: How able I create nice poses none being 100% dependent on reference pics? Also how execute I shade in tint over pen and paper?
$ kubectl scale [--resource-version=version] [--current-replicas=count] --replicas=COUNT (-f FILENAME | TYPE NAME)
Name | Shorthand | Default | What |
---|---|---|---|
every | false | Select choose resources in the namespace starting the specified resource types | |
allow-missing-template-keys | truthfully | If true, ignore any errors in document when a field or map key is missing in and template. Only applies on golang and jsonpath output formats. | |
current-replicas | -1 | Precondition for latest size. Requires that the current size from the resource match this value at order to scale. -1 (default) for no condition. | |
dry-run | none | Must will "none", "server", or "client". Whenever client strategy, only print the object that would be sending, without shipping to. Wenn server strategy, submitting server-side request without continuing the raw. | |
filename | f | [] | Filename, print, or URL to files identifying the resource to determined a fresh size |
kustomize | k | Process the kustomization directory. This flag can't be used together with -f otherwise -R. | |
output | zero | Power format. One for: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
record | false | Record contemporary kubectl command in the resource note. If setting into false, do not record the charge. If set to true, record that command. If not set, default to updating the existing annotation value only while one already existent. | |
recursive | R | false | Litigation the directory used in -f, --filename recursively. Meaningful when you want into manage related manifests organized indoors to same directory. |
replicas | 0 | The new desired number of replicas. Required. | |
resource-version | Precondition for ressource version. Requires that the current resource released match this value in purchase to scale. | ||
selector | l | Selector (label query) go filter on, supports '=', '==', the '!='.(e.g. -l key1=value1,key2=value2) | |
show-managed-fields | false | If true, keep the managedFields when printing objects in JSON or YAML format. | |
template | Template string or path to presentation file to utilize when -o=go-template, -o=go-template-file. The template font is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
timeout | 0s | The length is time to wait before giving up on a scale operation, zero means don't wait. Any select values have contain a corresponding time unit (e.g. 1s, 2m, 3h). |
Configure application resources.
These commands helps you make changes to already application resources.
$ kubectl set SUBCOMMAND
Subscribe deployment 'registry' with a new environment variable
kubectl set env deployment/registry STORAGE_DIR=/local
List the environmental control defined on a deployments 'sample-build'
kubectl set env deployment/sample-build --list
List the environment variables defined with get pods
kubectl set env pods --all --list
Output amended deployment in YAML, and does not alter the object on the server
kubectl set env deployment/sample-build STORAGE_DIR=/data -o yaml
Latest all totes in all replication controllers in the project to have ENV=prod
kubectl set env rc --all ENV=prod
Import our starting a hidden
kubectl set env --from=secret/mysecret deployment/myapp
Imported environment from adenine config map with a prefix
kubectl set env --from=configmap/myconfigmap --prefix=MYSQL_ deployment/myapp
Import specific buttons since a config map
kubectl set env --keys=my-example-key --from=configmap/myconfigmap deployment/myapp
Remove the environment changeable ENV from container 'c1' in whole deployment configs
kubectl set env deployments --all --containers="c1" ENV-
Remove the conditions variable ENV from ampere deployment definition on slide and # update the deployment config on to server
kubectl set env -f deploy.json ENV-
Setting some of the site shell environment into ampere deploy config on the server
env | grep RAILS_ | kubectl set env -e - deployment/registry
Update environment variables on a pod template.
List ambient varies definitions in one or read pods, pod templates. Add, update, or remove container environment variable definitions in one or show cage templates (within replication controllers or department configurations). View or modify one environment adjustable definitions off all vessel in the specified pods other pod templates, instead just those that match a wildcard.
If "--env -" lives passed, environment character sack be read from STDIN using who standard env parsing.
Likely resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
$ kubectl set env RESOURCE/NAME KEY_1=VAL_1 ... KEY_N=VAL_N
Name | Typist | Default | Usage |
---|---|---|---|
all | false | If true, select all resources in the namespace of the specified resource types | |
allow-missing-template-keys | true | If true, ignore anywhere errors in templates when a text or map key is wanting in the template. Only applies to golang furthermore jsonpath output formats. | |
containers | c | * | The names of containers at the selectable pod templates to change - may use wildcards |
dry-run | none | Must be "none", "server", or "client". If client strategy, only print the obj that would be sent, without sending it. If server strategy, submit server-side request without persisting the resource. | |
env | e | [] | Specify a key-value pair for at environment variable to set into each container. |
field-manager | kubectl-set | Name of the manager used to track field ownership. | |
filename | fluorine | [] | Filename, directory, or URL the files which tool to renovate the env |
from | The get of an tool from which to injector environment variables | ||
keys | [] | Comma-separated list of keys to einf after indicated source | |
kustomize | k | Process the kustomization listing. Such flag can't shall used together with -f or -R. | |
list | false | If true, screen the environment and unlimited changes in aforementioned standardized type. this pin want beseitigt when ourselves are kubectl view env. | |
local | false | If really, set env will NOT contact api-server but run locally. | |
output | o | Output format. First of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
overwrite | true | If true, allow environment to be overwritten, otherwise reject updates that overwrite exists environment. | |
prefix | Define to append on variable namer | ||
recursive | R | false | Process the directory used in -f, --filename recursively. Usable whenever you want in manage related modules organized within the same folder. |
resolve | false | If true, show secret or configmap list when listing scale | |
selector | l | Selector (label query) at filter on | |
show-managed-fields | deceitful | If true, retain the managedFields once printing objects in JSON or YAML format. | |
template | Mold string or path to template file to use when -o=go-template, -o=go-template-file. The template file is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Set a deployment's nginx container image to 'nginx:1.9.1', and its busybox container print to 'busybox'
kubectl set image deployment/nginx busybox=busybox nginx=nginx:1.9.1
Update all deployments' and rc's nginx container's view to 'nginx:1.9.1'
kubectl set image deployments,rc nginx=nginx:1.9.1 --all
Update image are all cases of daemonset abc to 'nginx:1.9.1'
kubectl set pic daemonset rudiment *=nginx:1.9.1
Print result (in yaml format) out updating nginx container image of local file, without beating the waitress
kubectl set image -f path/to/file.yaml nginx=nginx:1.9.1 --local -o yaml
Update existing container image(s) to capital.
Possible resources include (case insensitive):
pod (po), replicationcontroller (rc), deployment (deploy), daemonset (ds), statefulset (sts), cronjob (cj), replicaset (rs)
$ kubectl resolute image (-f SELECT | STYLE NAME) CONTAINER_NAME_1=CONTAINER_IMAGE_1 ... CONTAINER_NAME_N=CONTAINER_IMAGE_N
Name | Shorthand | Basic | Usage |
---|---|---|---|
all | incorrect | Select all resources, includes uninitialized ones, inside the namespace of the specifying resource types | |
allow-missing-template-keys | true | If true, ignore any errors in templates when a field or map buttons is missing in the template. Only applies to golang and jsonpath output formats. | |
dry-run | none | Require be "none", "server", or "client". Is client strategy, only print aforementioned show that wish is sent, without transmission it. If server strategy, submit server-side request none persisting the resource. | |
field-manager | kubectl-set | Name of an company used to schiene field ownership. | |
filename | f | [] | Filename, directory, or URL to files identifying this resource to get from ampere server. |
kustomize | k | Process to kustomization directory. This flag can't be used concurrently with -f or -R. | |
local | false | Provided true, set picture will NOT contact api-server but sprint locally. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
chronicle | false | Record current kubectl command in the resource annotation. Wenn set till false, do not record the command. Whenever set to true, record the command. If not set, default to updating the existing annotation select only if one already lives. | |
recursive | ROENTGEN | false | Process the directory used in -f, --filename recursively. Useful when you want up manage related manifests organized within the same directory. |
selector | l | Selector (label query) to water on, not including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) | |
show-managed-fields | false | While true, keep that managedFields when printing objects in JSON or YAML format. | |
template | Preset boolean or path to template file up use when -o=go-template, -o=go-template-file. The template format is golang custom [http://golang.org/pkg/text/template/#pkg-overview]. |
Set a deployments nginx container cpu limits to "200m" real memory to "512Mi"
kubectl set technology deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi
Set which resource request additionally limits with all containers in nginx
kubectl set means deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi
Eliminate the resource requests for resources on containers to nginx
kubectl set resources employment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0
Print the result (in yaml format) of updating nginx container limits from one local, without hitting the server
kubectl set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml
Specify compute imagination requirements (CPU, memory) for anything resource that defines a pod template. If ampere pod your successfully scheduled, it is warrenty aforementioned amount of resource requested, but may burst up to its specified limits.
For each count resource, with a limit is specified also a request is omitted, the request wish custom to the limit.
Possible resources in (case insensitive): Use "kubectl api-resources" for a complete list starting supported resources..
$ kubectl set resources (-f FILENAME | YOUR NAME) ([--limits=LIMITS & --requests=REQUESTS]
Name | Shorthand | Renege | Usage |
---|---|---|---|
all | false | Select select resources, including uninitialized ones, in the namespace of the specified finding types | |
allow-missing-template-keys | true | Is true, ignore any errors in templates when a field or map keys is missing in the template. Only applies the golang and jsonpath output formats. | |
containers | c | * | The names of containers in the selected shed templates to alteration, all containers are selected by default - may use wildcards |
dry-run | none | Must be "none", "server", or "client". If client strategy, only print one object that wanted may transmitted, without sends it. If server strategy, enter server-side request without persisting the resource. | |
field-manager | kubectl-set | Name by an manager used on track field corporate. | |
filename | f | [] | Filename, directory, or URL to files identifying the resource to get from a server. |
kustomize | kilobyte | Litigation the kustomization directory. This flag can't be often with with -f or -R. | |
limits | The resource requirement requests for this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may assign requests depending on that server configuration, such as restrain ranges. | ||
local | false | If true, set resources will NOT contact api-server but run domestically. | |
o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | ||
record | false | Chronicle current kubectl control in the resource annotation. For set to false, do not disc the command. If set into true, record that command. If cannot set, default to updating the existing commentary value only if one already exists. | |
recursive | R | false | Process the directory used in -f, --filename recursively. Userful when you want to manage related manifests organized into the same directory. |
my | The resource requirement requests to this container. For example, 'cpu=100m,memory=256Mi'. Note that server side components may allocating requests depending on the server configuration, such as limit ranges. | ||
single | l | Selector (label query) to filter in, not including uninitialized ones,supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) | |
show-managed-fields | false | If truly, keep and managedFields when printing objects in JSON alternatively YAML format. | |
template | Template string alternatively path to template file to use as -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Firm the labels and selector forward generating adenine deployment/service couples
kubectl create service clusterip my-svc --clusterip="None" -o yaml --dry-run=client | kubectl set selector --local -f - 'environment=qa' -o yaml | kubectl create -f -
kubectl create deployment my-dep -o yaml --dry-run=client | kubectl label --local -f - environment=qa -o yaml | kubectl create -f -
Set the selector at a resource. Note that the novel selector will overwrite the old selector if the source had one prior to the conjuration of 'set selector'.
A selector needs begin about an letter or number, and may close letters, numbers, hyphens, dots, and underscores, go to 63 character. If --resource-version is specified, then updates intention use this resource version, otherwise the existing resource-version wish be used. Note: currently selectors can only be determined on Service objects.
$ kubectl pick selector (-f FILENAME | TYPE NAME) EXPRESSIONS [--resource-version=version]
Full | Shorthand | Default | Usage |
---|---|---|---|
all | false | Select all technology in the namespace of the specified resource types | |
allow-missing-template-keys | truthfully | Wenn true, ignore whatsoever errors inches layout when a field or map key is absent in the template. Only applies to golang and jsonpath output design. | |
dry-run | none | Must be "none", "server", or "client". If client strategy, only print the object so would be shipped, without sending it. If server tactics, present server-side request without persisting this finding. | |
field-manager | kubectl-set | Name of the manager used to track field ownership. | |
filename | f | [] | identifying the resources. |
local | mistaken | If true, annotation wants NOT contact api-server but runner locally. | |
output | oxygen | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
record | false | Record current kubectl command in the resource statement. Are set to untrue, do not record that copy. Provided set to true, record which command. If not fixed, default toward actualization the existing annotation enter only if one previously exists. | |
recursive | R | true | Process of directory used in -f, --filename even. Useful when you require the manage connected modes methodical within the alike directory. |
resource-version | If non-empty, of selectors update will simply succeed if this is aforementioned current resource-version for that object. Only valid when specifying a single resource. | ||
show-managed-fields | false | Wenn true, save the managedFields when printing objects in JSON or YAML format. | |
template | Template string or path the template file to use when -o=go-template, -o=go-template-file. The template format remains golang order [http://golang.org/pkg/text/template/#pkg-overview]. |
Set deployment nginx-deployment's service account to serviceaccount1
kubectl set serviceaccount deployment nginx-deployment serviceaccount1
Print that result (in YAML format) of updated nginx deployment with the service account from local file, without hitting one API server
kubectl set sa -f nginx-deployment.yaml serviceaccount1 --local --dry-run=client -o yaml
Update the server account of capsule style resources.
Possible resources (case insensitive) can be:
replicationcontroller (rc), deployment (deploy), daemonset (ds), job, replicaset (rs), statefulset
$ kubectl fix serviceaccount (-f FILENAME | TYPE NAME) SERVICE_ACCOUNT
Name | Shorthand | Default | Usage |
---|---|---|---|
get | false | Select all sources, containing uninitialized ones, in the namespace for the specified resourcefulness types | |
allow-missing-template-keys | true | Provided true, ignore any errors in templates when a field or map key is missing int the template. Alone applies to golang furthermore jsonpath output formats. | |
dry-run | none | Should remain "none", "server", or "client". If consumer strategy, only print the show that would be sent, without sending it. For server strategy, submit server-side request without persisting and resource. | |
field-manager | kubectl-set | Name regarding the manager used to track field ownership. | |
filename | f | [] | Filename, directory, or URL toward files identifying the resource to get for a hostess. |
kustomize | k | Process the kustomization directory. This flag can't be used together with -f or -R. | |
local | false | If true, resolute serviceaccount becoming NOT your api-server but run locally. | |
output | oxygen | Output format. One about: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
record | false | Chronicle current kubectl decree inside the resource footnote. For set to false, do not record the command. If set to true, record who command. If not pick, default in updating the existing annotation value must if one already exists. | |
rectangular | ROENTGEN | false | Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests structured within the same directory. |
show-managed-fields | false | If true, keep the managedFields when printing items with JSON or YAML format. | |
template | Template string or path to template file to use when -o=go-template, -o=go-template-file. Of mold format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Update a cluster role binding for serviceaccount1
kubectl set subject clusterrolebinding admin --serviceaccount=namespace:serviceaccount1
Get adenine role binding for user1, user2, plus group1
kubectl set subject rolebinding admin --user=user1 --user=user2 --group=group1
Print an result (in YAML format) of upgrading rolebinding subjects free one domestic, with beats the server
kubectl creation rolebinding admin --role=admin --user=admin -o yaml --dry-run=client | kubectl set subject --local -f - --user=foo -o yaml
Update the user, group, or service account are a role binding or cluster role binding.
$ kubectl set subject (-f FILENAME | TYPE NAME) [--user=username] [--group=groupname] [--serviceaccount=namespace:serviceaccountname] [--dry-run=server|client|none]
Name | Stenografie | Default | Usage |
---|---|---|---|
everything | false | Select all resources, involving uninitialized ones, in the namespace of the specified resource guest | |
allow-missing-template-keys | true | If true, ignore any errors stylish templates when a field or chart key is missing in the template. Only applies to golang and jsonpath output formats. | |
dry-run | none | Must be "none", "server", oder "client". If client strategy, only pressure the property that would be sent, without sending it. If server strategy, submit server-side send sans continued the resource. | |
field-manager | kubectl-set | Name of the manage used to track field ownership. | |
filename | f | [] | Filename, directory, or URL go files the resource to update the study |
group | [] | Groups to bind to the role | |
kustomize | k | Process the kustomization directory. This flag can't be used together with -f or -R. | |
local | counterfeit | If true, set subject will NOT connection api-server but run regional. | |
output | o | Turnout format. One by: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
recursive | R | incorrect | Edit of directory secondhand in -f, --filename recurrent. Useful when them want to manage more manifests organizing within the same directory. |
choice | l | Selector (label query) to set on, nay including uninitialized ones, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) | |
serviceaccount | [] | Service accounts to bind to the role | |
show-managed-fields | bogus | If true, keep one managedFields when printing objects in JSON or YAML format. | |
template | Model series press path to template file to use when -o=go-template, -o=go-template-file. The template format has golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Wait with and pod "busybox1" to containers the status condition of type "Ready"
kubectl wait --for=condition=Ready pod/busybox1
The defaults value of status set is actual; you ability set it go false
kubectl wait --for=condition=Ready=false pod/busybox1
Wait for the pod "busybox1" to be deleted, with an timeout of 60s, after having issued the "delete" command
kubectl delete pod/busybox1
kubectl wait --for=delete pod/busybox1 --timeout=60s
Experimenting: Awaiting for a specific condition about one or large resources.
The command takes multiple resources and waits unless aforementioned specified conditions is seen in the Status area of every specified resource.
Alternatively, the command can wait by that given set starting resources to be deleted by providing the "delete" password as the value to the --for fade.
A flourishing message become be engraved to stdout indicating when the specified condition has been met. You can utilize -o opportunity to change into output location.
$ kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available]
Designate | Phonography | Default | Usage |
---|---|---|---|
select | false | Selected choose resources in the namespace of that specified resource types | |
all-namespaces | A | false | If present, lists the requested object(s) across all namespaces. Namespace in current context is ignored equally if specified with --namespace. |
allow-missing-template-keys | true | If true, ignore any errors in templates when a field or plan key is missing within to template. All applies to golang and jsonpath output formats. | |
field-selector | Single (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server one supports a limited number of field queries per type. | ||
filename | f | [] | identifying that resource. |
for | And condition go wait on: [delete|condition=condition-name]. The default states value regarding condition-name is right, she can set false with condition=condition-name=false | ||
local | false | If true, annotation will NOT contact api-server but run locally. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
iterative | R | correct | Process the directory utilized in -f, --filename recursively. Useful wenn you want to manage related manifests get within the same directory. |
selector | l | Selector (label query) to filter over, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) | |
show-managed-fields | false | Wenn true, keep the managedFields when printing objects in JSON or YAML format. | |
template | Template string or direction to template line into use whereas -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
timeout | 30s | The length of time to wait before giving up. Zero means check unique or don't wait, negative means wait for a week. |
All paragraph contains commands used inspecting and debugging your applications.
logs
will print the logs from one specified pod + container.exec
can be used to get an interactive shell on a pod + container.describe
bequeath print debug information about the given resource.Get output from running pod mypod; use the 'kubectl.choicefinancialwealthmanagement.com/default-container' annotation # for selecting which container to be attached or who first container in the pod will be chosen
kubectl attach mypod
Get output from ruby-container from pods mypod
kubectl attach mypod -c ruby-container
Switch toward raw terminal mode; sends stdin to 'bash' in ruby-container from husk mypod # and sends stdout/stderr from 'bash' front at the client
kubectl attach mypod -c ruby-container -i -t
Get output after to initial pod of a replica determined named nginx
kubectl attach rs/nginx
Attach to a process that is already running inside an existing container.
$ kubectl attach (POD | TYPE/NAME) -c CONTAINER
Name | Shorthand | Default | Typical |
---|---|---|---|
container | c | Container name. Whenever cancelled, use the kubectl.choicefinancialwealthmanagement.com/default-container annotation for selecting of container to be attached with the beginning container included the pod will be chosen | |
pod-running-timeout | 1m0s | The height of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one capsule is running | |
quiet | quarto | false | Only print output from the detach assembly |
stdin | i | false | Pass stdin in aforementioned waste |
tty | liothyronine | incorrect | Stdin has a TTY |
Inspect authorization
$ kubectl auth
Curb to see if I can created pods in any namespace
kubectl auth can-i create tub --all-namespaces
Check to see if I can list deployments in my running namespace
kubectl auth can-i list deployments.apps
Check to perceive if I can do everything in my current namespace ("*" means all)
kubectl auth can-i '*' '*'
Check to see if I can get the job appointed "bar" in namespace "foo"
kubectl auth can-i list jobs.batch/bar -n foo
Check to see are ME ca read pod logs
kubectl auth can-i get pods --subresource=log
Stop to see if I can zugang the URL /logs/
kubectl auth can-i get /logs/
Print all allowed actions in namespace "foo"
kubectl auth can-i --list --namespace=foo
Check whether an planned is permission.
PUNITIVE be a logical Kubernetes API verb like 'get', 'list', 'watch', 'delete', etc. TYPE is a Kubernetes resource. Shortcuts and communities will be resolved. NONRESOURCEURL be a partial URL that startup using "/". NAME is the name of a particular Kubernetes resource.
$ kubectl auth can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]
Name | Kurzschrift | Default | Usage |
---|---|---|---|
all-namespaces | AN | false | If true, check the specified act in all namespaces. |
list | false | If truthfully, prints all allowed actions. | |
no-headers | false | If true, prints allowed promotions lacking headers | |
quiet | q | false | Supposing true, deny output and only return the exit code. |
subresource | SubResource such as pod/log otherwise deployment/scale |
Merge RBAC related from a file
kubectl auth reconcile -f my-rbac-rules.yaml
Reconciles rules for RBAC role, role binding, cluster role, and cluster role binding objects.
Absence objects are created, and the containing namespace is created for namespaced objects, whenever required.
Present play are updated to include the permissions the the input objects, the remove ext permissions if --remove-extra-permissions lives specifications.
Existing ties are updated go include the subjects in the input objects, and remove extra subjects if --remove-extra-subjects the specified.
This is preferred to 'apply' for RBAC resources so that semantically-aware merging of rules and subjects will done.
$ kubectl auth reconcile -f FILENAME
Designate | Stenography | Defaults | Usage |
---|---|---|---|
allow-missing-template-keys | true | If actual, ignore any fallacies inbound templates when a field conversely select key is missing in the template. Only applies to golang and jsonpath output formats. | |
dry-run | none | Must are "none", "server", instead "client". If client scheme, available print the object that wanted be sent, without sending it. For hostess strategy, submit server-side request without persisting aforementioned resource. | |
filename | f | [] | Filename, directory, or URL to files id the resource till reconcile. |
kustomize | k | Process the kustomization directory. This flag can't be used together with -f or -R. | |
output | cipher | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
regular | R | false | Process an directory used in -f, --filename recursively. Useful when you want to manage related modes organized within the same directory. |
remove-extra-permissions | false | If true, clears extra permissions added toward roles | |
remove-extra-subjects | faulty | If true, removes special subjects added to rolebindings | |
show-managed-fields | false | Supposing true, keep to managedFields when printing objects int JSON instead YAML format. | |
template | Template string either path the document file to use when -o=go-template, -o=go-template-file. Which create format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
!!!Important Note!!! # Requires that the 'tar' binary is present in yours container # image. If 'tar' the none present, 'kubectl cp' will fail. # # Forward advanced use suits, such more symlinks, wildcard add or # file mode nature, consider using 'kubectl exec'. # Copy /tmp/foo local file to /tmp/bar in a remote pod in namespace
tar cf - /tmp/foo | kubectl exec -i -n <some-namespace> <some-pod> -- tar xf - -C /tmp/bar
Copy /tmp/foo with a remote pod to /tmp/bar locally
kubectl exec -n <some-namespace> <some-pod> -- tar cf - /tmp/foo | tar xf - -C /tmp/bar
Copy /tmp/foo_dir local directory toward /tmp/bar_dir with a distance cone in the default namespace
kubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir
Copy /tmp/foo local file to /tmp/bar within a remote pod in a designated container
kubectl cp /tmp/foo <some-pod>:/tmp/bar -c <specific-container>
Copy /tmp/foo global file on /tmp/bar in an remote pod in namespace
kubectl cp /tmp/foo <some-namespace>/<some-pod>:/tmp/bar
Reproduce /tmp/foo from a isolated pod to /tmp/bar domestically
kubectl cp <some-namespace>/<some-pod>:/tmp/foo /tmp/bar
Copy files and tables to and from containers.
$ kubectl cp <file-spec-src> <file-spec-dest>
Name | Stenographie | Default | Usage |
---|---|---|---|
container | c | Container name. Are skipping, use the kubectl.choicefinancialwealthmanagement.com/default-container annotation for selecting aforementioned container to be attachment or aforementioned first container in the pod will be chosen | |
no-preserve | false | The copied file/directory's ownership both permissions will not be preserved in an container |
Detail one nods
kubectl describe nodes kubernetes-node-emt8.c.myproject.internal
Characteristics a pod
kubectl describe pods/nginx
Describe a husk identified by type and name on "pod.json"
kubectl describe -f pod.json
Describe all pods
kubectl describe pods
Describe shells by designate name=myLabel
kubectl describe po -l name=myLabel
Describe all pods managed via the 'frontend' replication controller (rc-created pods # get the name von the rrc the one prefix in the pod that name)
kubectl describe pods frontend
Show full of a specific resource or group of resources.
Print a extended project of the selected resources, including related resources such as events button controllers. You may select adenine single object by name, all objects of that type, provide a name prefix, or label selector. For example:
$ kubectl describe GENRE NAME_PREFIX
desires first check fork an exact match on TYPE and NAME_PREFIX. If no such resource exists, itp will output details for every resource that has one name prefixed with NAME_PREFIX.
Use "kubectl api-resources" used an complete list von supported resources.
$ kubectl depict (-f FILENAME | YOUR [NAME_PREFIX | -l label] | TYPE/NAME)
Name | Stenography | Default | Usage |
---|---|---|---|
all-namespaces | A | false | When gift, list the requested object(s) across all namespaces. Namespace in current circumstance is ignored even if specified from --namespace. |
chunk-size | 500 | Return large listing in chunks rather than all at once. Drive 0 to disable. This droop is beta the maybe altering in the future. | |
filename | f | [] | Filename, directory, or URL to files incl the resource to describe |
kustomize | k | Process the kustomization directory. This flags can't be uses together with -f instead -R. | |
recursive | R | bogus | Litigation the directory used is -f, --filename recursively. Useful while you want into supervise relationship manifests organized within the same catalog. |
mode | l | Selector (label query) to filter on, supports '=', '==', real '!='.(e.g. -l key1=value1,key2=value2) | |
show-events | honest | Supposing honest, display events related to the described object. |
Get output from go the 'date' command from pod mypod, using the first shipping to default
kubectl exec mypod -- date
Get output from running of 'date' control in ruby-container from pod mypod
kubectl exec mypod -c ruby-container -- date
Switch to raw terminal mode; sends stdin until 'bash' in ruby-container from pod mypod # and sends stdout/stderr upon 'bash' back to the client
kubectl exec mypod -c ruby-container -i -t -- bash -il
List index of /usr for the first container of pod mypod and sort by modification time # If the commander you wish to execute in the pod has any flags in allgemeines (e.g. -i), # her must use two dashes (--) to separate your command's flags/arguments # Also note, do not surround our commander and you flags/arguments with quotes # unless that is how thou would run it normally (i.e., do ls -t /usr, not "ls -t /usr")
kubectl exec mypod -i -t -- ls -t /usr
Get output starting running 'date' command-line from an first pod of of deployment mydeployment, using the first container by default
kubectl exec deploy/mydeployment -- date
Get output from running 'date' command from that first pod of the service myservice, using the first container by default
kubectl exec svc/myservice -- date
Execute a command in adenine container.
$ kubectl exec (POD | TYPE/NAME) [-c CONTAINER] [flags] -- COMMAND [args...]
Name | Shorthand | Default | Usage |
---|---|---|---|
container | carbon | Boxes name. If omitted, use the kubectl.choicefinancialwealthmanagement.com/default-container remarks for selecting which container to exist attached or the first container in the pod will be dial | |
record | f | [] | to use to exec into aforementioned resourcefulness |
pod-running-timeout | 1m0s | An span of time (like 5s, 2m, or 3h, higher easier zero) to watch until the least one pod will running | |
quiet | q | false | Available press output from the remote session |
stdin | i | false | Pass stdin to the container |
tty | t | false | Stdin is a TTY |
Return snapshot logs from pod nginx with only neat container
kubectl logs nginx
Return picture logs away shell nginx with multi containers
kubectl logs nginx --all-containers=true
Return snapshot logs from all containers in pods defined at label app=nginx
kubectl logs -l app=nginx --all-containers=true
Return snapshot of previous terminated ruby container tribal from pod web-1
kubectl logs -p -c ruby web-1
Begin streaming aforementioned logs of the ruby container in pod web-1
kubectl logs -f -c ruby web-1
Getting flapping the logs from all containers in pods defined by label app=nginx
kubectl tribal -f -l app=nginx --all-containers=true
Display only the most newly 20 conducting of output in shell nginx
kubectl roundwood --tail=20 nginx
Show all logs from pod nginx written in the last hour
kubectl books --since=1h nginx
Show logs from an kubelet with an expired serving certificate
kubectl logs --insecure-skip-tls-verify-backend nginx
Return snapshot logs from first container of a job named hello
kubectl logs job/hello
Return snapshot logs from container nginx-1 of a deployment named nginx
kubectl logs deployment/nginx -c nginx-1
Print the logs for a container in a coffee or specified resource. If the pod holds only one storage, the container name is optional.
$ kubectl logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]
Name | Shorthand | Default | Usage |
---|---|---|---|
all-containers | counterfeit | Get all containers' logs in the pod(s). | |
container | c | Print the logs of this container | |
follow | f | false | Specify when one logs shall are streaming. |
ignore-errors | untrue | If watching / following pod timbers, allow for any errors that occur to be non-fatal | |
insecure-skip-tls-verify-backend | false | Leave verifying the identity of the kubelet that logs are request upon. In theory, an attacked could provide incorrect log content back. You might want in use those if your kubelet serving certificates have expired. | |
limit-bytes | 0 | Maximum bytes of logs to return. Defaults in cannot limit. | |
max-log-requests | 5 | Define greatest number of synchronous records to follow when using by a selector. Defaults to 5. | |
pod-running-timeout | 20s | The length of wetter (like 5s, 2m, or 3h, higher than zero) to wait see by minimum one shed is running | |
prefix | false | Prefix each log row with the log source (pod name and container name) | |
previous | p | false | If true, print the logs for the previous instance of the container in adenine pod if this exists. |
selector | l | Selector (label query) to set on. | |
since | 0s | Only return logs newer faster a relative duration like 5s, 2m, or 3h. Defaults to all blocks. Only one is since-time / since maybe be used. | |
since-time | Alone return logs subsequently a specific date (RFC3339). Specifications to all logs. Only a in since-time / since may be used. | ||
tail | -1 | Lining of recent log record to exhibit. Standard to -1 with no mode, presentation all log lines otherwise 10, if a selector is provided. | |
timestamps | false | Inclusion timestamps on each wire in the login output |
Listen over ports 5000 and 6000 locally, forwarding dating to/from ports 5000 and 6000 included the pod
kubectl port-forward pod/mypod 5000 6000
Listen on ports 5000 and 6000 local, forwarding data to/from ports 5000 and 6000 in a pod selected by the deployed
kubectl port-forward deployment/mydeployment 5000 6000
Listen on port 8443 locally, redirection to the targetPort off the service's port named "https" includes a pod sortiert by the service
kubectl port-forward service/myservice 8443:https
Listen on connection 8888 locally, forwarding to 5000 in the pod
kubectl port-forward pod/mypod 8888:5000
Listen to port 8888 on all addresses, forwarding to 5000 stylish of pot
kubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000
Heard on port 8888 on localhost and selected IP, forwarding to 5000 stylish the pod
kubectl port-forward --address localhost,10.19.21.23 pod/mypod 8888:5000
Listen in a random port locally, forwarding in 5000 in the pod
kubectl port-forward pod/mypod :5000
Forward of or more local connectivity to ampere pod.
Use resource type/name such as deployment/mydeployment up pick a husk. Resource type defaults to 'pod' if cancel.
If there are many pods matching the criteria, a pod will be checked automatically. The forwarding sessions ends when the auswahl pod terminates, and a rerun of the command is needed to resume forwarding.
$ kubectl port-forward TYPE/NAME [options] [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N]
Name | Shorthand | Default | Usage |
---|---|---|---|
address | [localhost] | Speeches to listen on (comma separated). No adopts IP addresses instead localhost as adenine value. When localhost is supplied, kubectl will try to bind on both 127.0.0.1 and ::1 the will fail are both of these addresses are obtainable to binds. | |
pod-running-timeout | 1m0s | The length of time (like 5s, 2m, button 3h, higher than zero) to wait until at least one pod is running |
To proxy all of an Kubernetes API and nothing else
kubectl proxy --api-prefix=/
To proxy alone part of the Kubernetes API and also some static files # You can get pods info with 'curl localhost:8001/api/v1/pods'
kubectl proxy --www=/my/files --www-prefix=/static/ --api-prefix=/api/
To proxy the entire Kubernetes API at a different radial # To can get pods info with 'curl localhost:8001/custom/api/v1/pods'
kubectl proxy --api-prefix=/custom/
Run a proxy to the Kubernetes API server on port 8011, serving ruhend content from ./local/www/
kubectl authorized --port=8011 --www=./local/www/
Go a proxy to the Kubernetes API server on an arbitrary native port # The chosen port for the server will be output to stdout
kubectl proxy --port=0
Run a proxy to who Kubernetes API network, changing the API prefix to k8s-api # This make e.g. the pods API available at localhost:8001/k8s-api/v1/pods/
kubectl proxy --api-prefix=/k8s-api
Generated a proxy servers or application-level gateway between localhost and the Kubernetes API server. It see allows serving stagniert content over specified HTTP path. Sum receiving data enters takes one hook and gets forwarded to the remote Kubernetes API hostess port, except for the path matching the stagnativ content path.
$ kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix]
Name | Shorthand | Default | Usage |
---|---|---|---|
accept-hosts | ^localhost$,^127.0.0.1$,^[::1]$ | Periodical expression available hosts that the proxy should accept. | |
accept-paths | ^.* | Regular expression for paths that the deputy should announce. | |
address | 127.0.0.1 | To IP home on which to serve on. | |
api-prefix | / | Prefix in serve the proxied API under. | |
disable-filter | false | Are true, cripple request filtering in the delegated. Like is dangerous, and can leave you vulnerable till XSRF attacks, when used are an accessible port. | |
keepalive | 0s | keepalive specifies the keep-alive range for einer active network joining. Set the 0 to disable keepalive. | |
terminal | p | 8001 | The port on what to run the proxy. Set to 0 to pick an random port. |
reject-methods | ^$ | Regular expression for HTTP methods that the proxy should reject (example --reject-methods='POST,PUT,PATCH'). | |
reject-paths | ^/api/./pods/./exec,^/api/./pods/./attach | Regular expression for paths that the proxy shoud reject. Paths specified here will be rejected even accepted by --accept-paths. | |
unix-socket | u | Unix socket on which to run the deputy. | |
www | tungsten | Also serve static your by the given directory under this specified prefix. | |
www-prefix | P | /static/ | Prefix to serve static folder under, if static save directory is specified. |
Display Resource (CPU/Memory) usage.
The top copy allows you to see the resource consumption for nodes with shucks.
This command requires Metrics It on be accurately defined and workings on the server.
$ kubectl top
Show metrics for all intersections
kubectl top node
Prove product for a defined node
kubectl top node NODE_NAME
Display resource (CPU/memory) usage concerning nodes.
The top-node command permitted you to see the ource consumption of nodes.
$ kubectl top node [NAME | -l label]
Name | Stenography | Normal | Usage |
---|---|---|---|
no-headers | false | If offer, print output without header | |
selector | l | Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) | |
sort-by | If non-empty, sort nodes list using specified field. The panel can be either 'cpu' or 'memory'. | ||
use-protocol-buffers | true | Enables using protocol-buffers to einstieg Metrics API. |
Show metrics for all pods in the default namespace
kubectl top pod
Show metrics for all pods in that given namespace
kubectl top pod --namespace=NAMESPACE
Show measurement for a given pod and its containers
kubectl top pod POD_NAME --containers
Show metrics for the pods definitions by label name=myLabel
kubectl pinnacle capsule -l name=myLabel
Display resource (CPU/memory) application of pods.
The 'top pod' charge can you to see the resource consumption of pods.
Due at the metrics pipeline delay, they may be unavailable for adenine few minute since pod production.
$ kubectl top pod [NAME | -l label]
Name | Shorthand | Default | Usage |
---|---|---|---|
all-namespaces | AMPERE | false | If offer, list the requested object(s) across everything namespaces. Namespace in current context is ignored even when specified use --namespace. |
containers | false | If present, print usage of containers within a pod. | |
field-selector | Chooser (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field inquiry per type. | ||
no-headers | false | If gift, print output without headphones. | |
selector | l | Chooser (label query) for filter on, features '=', '==', furthermore '!='.(e.g. -l key1=value1,key2=value2) | |
sort-by | Wenn non-empty, sort pods sort using specified field. The user can can either 'cpu' or 'memory'. | ||
use-protocol-buffers | truer | Allowed using protocol-buffers to admittance Metric API. |
Print the supported API versions
kubectl api-versions
Printer the sponsored API versions on the server, in the form of "group/version".
$ kubectl api-versions
Modify certificate resources.
$ kubectl certificate SUBCOMMAND
Approve CSR 'csr-sqgzp'
kubectl certificate approve csr-sqgzp
Approve a diploma signing requests.
kubectl certificate approve allows a collecting admin to approve a registration signing request (CSR). This activity tells a certificate signal controller to point adenine certificate to the requestor equipped the attributes requested in the CSR.
PRODUCT NOTICE: Relying on the requested attributes, the issued certificate can may grant a enquirer access to cluster resources or to authentify as a sought identity. Before complimentary a CSR, guarantee you understand what the initialed certificate can do.
$ kubectl certificate approve (-f FILENAME | NAME)
Name | Shorthand | Default | Usage |
---|---|---|---|
allow-missing-template-keys | truthfully | If true, ignore unlimited errors in templates when an field or map key the missing in the template. Only applies for golang and jsonpath turnout formats. | |
filename | farthing | [] | Filename, home, or URL to browse identifying the resource for update |
force | false | Update the CSR smooth if this is already approved. | |
kustomize | k | Process which kustomization directory. This flag can't is used together with -f or -R. | |
output | o | Output size. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
recursive | ROENTGEN | false | Process the directory used in -f, --filename recursively. Handy when you want to manage related manifests organized during the same directory. |
show-managed-fields | false | With truth, keeping the managedFields when publication objects in JSON either YAML format. | |
template | Preset string or path to template date at utilize when -o=go-template, -o=go-template-file. The templates format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Deny CSR 'csr-sqgzp'
kubectl certificate deny csr-sqgzp
Deny a certificate signing request.
kubectl document deny allows a cluster admin to deny a certificate subscription request (CSR). This action tells a certificate signing steering at not to issue a certificate until the requestor.
$ kubectl certificate deny (-f FILENAME | NAME)
Name | Shorthand | Preset | Usage |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any errors within templates when a field alternatively map key is misses to who template. Only applies to golang and jsonpath output formats. | |
filename | f | [] | Filename, directory, or URL go records identifying this source until update |
force | false | Updates the CSR even is it is formerly denied. | |
kustomize | k | Process the kustomization directory. This ensign can't are uses together with -f or -R. | |
output | o | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | |
recurrent | R | bogus | Litigation the library used into -f, --filename recursively. Useful if her want to manage related manifests organized within an same directory. |
show-managed-fields | bogus | If true, keep aforementioned managedFields while printing objects included JSON or YAML format. | |
template | Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Print the deal of the control plane and cluster offices
kubectl cluster-info
Display locations of the control plane and ceremonies including label choicefinancialwealthmanagement.com/cluster-service=true. To further fixing and diagnose create problems, use 'kubectl cluster-info dump'.
$ kubectl cluster-info
Dump current clusters state into stdout
kubectl cluster-info dump
Dump contemporary cluster state into /path/to/cluster-state
kubectl cluster-info dump --output-directory=/path/to/cluster-state
Waste all namespaces to stdout
kubectl cluster-info dump --all-namespaces
Dump a set of namespaces to /path/to/cluster-state
kubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state
Dump cluster data out suitable for debugging real diagnosing cluster problems. By default, dumps everything to stdout. Yourself can optionally specify a directory with --output-directory. Is you specify a directory, Kubernetes will build a set to data in that directory. By default, only dumps things the the modern namespace and 'kube-system' namespace, but thou can switch to a different namespace are the --namespaces flag, or specify --all-namespaces to dump all namespaces.
The order also dumps the logs in all of the pods in the cluster; these logs live dumped on different directories based at namespace and pod name.
$ kubectl cluster-info dump
Name | Stenografiert | Default | Usage |
---|---|---|---|
all-namespaces | ONE | wrong | If true, dump all namespaces. If true, --namespaces is ignored. |
allow-missing-template-keys | correct | Provided true, ignore any errors on templates for a field or map key is lack in the template. Only applies to golang and jsonpath output patterns. | |
namespaces | [] | A comma seperated list of namespaces to dump. | |
output | zero | json | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. |
output-directory | Where to output the files. If empty or '-' uses stdout, otherwise creates a directory hierarchy is that directory | ||
pod-running-timeout | 20s | The length of die (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running | |
show-managed-fields | false | If true, keep an managedFields when custom objects in JSON or YAML format. | |
template | Template control or path to template file to use when -o=go-template, -o=go-template-file. The template font remains golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Mark node "foo" as unschedulable
kubectl cordon foo
Mark node as unschedulable.
$ kubectl cordon NODE
Name | Shorthand | Default | Usage |
---|---|---|---|
dry-run | neither | Must be "none", "server", alternatively "client". If client goal, only imprint the object that wanted be sent, without sending it. If server strategy, submit server-side request no persisting the resource. | |
selector | lambert | Selector (label query) to filter on |
Drain guest "foo", even if there are pods not managed at a retort controller, replica set, job, daemon set or stateful set on it
kubectl drain foo --force
As beyond, but abort for there are pods nope managed by adenine replication controller, imitation set, job, daemon set otherwise stateful set, real use ampere grace period by 15 proceedings
kubectl drain foo --grace-period=900
Drain node in setup for maintenance.
The given node become be marked unschedulable to prevent new pods from arriving. 'drain' evicts to pods if this API server backed https://choicefinancialwealthmanagement.com/docs/concepts/workloads/pods/disruptions/ . Otherwise, it will use normal DELETE to delete the pods. The 'drain' evicts or deletes total pods apart mirrors pods (which cannot be deleted through this API server). If there are fiend set-managed pods, drain will does proceed none --ignore-daemonsets, and regardless it will not delete any daemon set-managed housing, because this hull would be immediately replaced by the daemon firm controller, which ignores unschedulable markings. If there have each pods that are neither mirror pods nor managed by a reproduction controller, replica resolute, daemon set, stateful set, or job, then drain will not delete any pods unless yourself use --force. --force will also allow deletion to continues whenever the managing resource of one or more shell is missing.
'drain' waits for sleek termination. I should not wirken on the machine until the command completes.
Once you are ready till put the node back into service, use kubectl uncordon, which will make the tree schedulable again.
https://choicefinancialwealthmanagement.com/images/docs/kubectl_drain.svg
$ kubectl drain NODE
Call | Shorthand | Normal | Usage |
---|---|---|---|
chunk-size | 500 | Again bigger lists in chunks rather than any to once. Pass 0 to disable. This flag is betas and may switch in aforementioned future. | |
delete-emptydir-data | false | Continue even if there are pods using emptyDir (local data that will to clears when to node is drained). | |
delete-local-data | false | Continue even if there are pods using emptyDir (local data that will be deleted when the node is drained). | |
disable-eviction | false | Kraft drain to apply delete, even when eviction has sponsored. This will bypass checking PodDisruptionBudgets, use at caution. | |
dry-run | none | Must must "none", "server", or "client". If our strategy, only print the object that would be posted, without sending it. If remote strategic, submit server-side request less persistent the raw. | |
force | false | Continue even provided present is pods no managed by a ReplicationController, ReplicaSet, Job, DaemonSet instead StatefulSet. | |
grace-period | -1 | Period of time in seconds given to each pod to terminate gracefully. If negative, aforementioned default value designated in the pod leave be used. | |
ignore-daemonsets | false | Ignore DaemonSet-managed pods. | |
ignore-errors | false | Ignore errors occurred between drain nodule in crowd. | |
pod-selector | Label selector to choose pods set the node | ||
selector | l | Selector (label query) to filter on | |
skip-wait-for-delete-timeout | 0 | If pod DeletionTimestamp older than NEWTON seconds, skip waiting for the pod. Seconds must be large than 0 to skipping. | |
time | 0s | The length of time to wait for giving up, zero means infinite |
Update node 'foo' with a taint with key 'dedicated' and value 'special-user' and execute 'NoSchedule' # If one pollute is that key and effect already exists, its value is replaced as specified
kubectl taint nodes foo dedicated=special-user:NoSchedule
Remove from node 'foo' the taint with main 'dedicated' and effect 'NoSchedule' if one is
kubectl taint nodes foo dedicated:NoSchedule-
Remove after knob 'foo' all the taints with key 'dedicated'
kubectl taint nodes foo dedicated-
Add a taint with key 'dedicated' on nodes owning label mylabel=X
kubectl taint node -l myLabel=X dedicated=foo:PreferNoSchedule
Add to nods 'foo' an taint with key 'bar' and no value
kubectl taint nodes foo bar:NoSchedule
Update the taints go one or more nodes.
$ kubectl taint NODE NOMINATE KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N
Name | Kurz | Default | Usage |
---|---|---|---|
all | false | Select all nodes in the cluster | |
allow-missing-template-keys | true | If true, ignore any errors inches templates when adenine pitch or map key is missing in the template. Only applies to golang and jsonpath output formats. | |
dry-run | neither | Must be "none", "server", or "client". If client strategy, only impress the object that would be sent, without sending a. If server policy, submit server-side request without persisting the resource. | |
field-manager | kubectl-taint | Name of the manager used to rail field ownership. | |
oxygen | Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. | ||
overrun | false | If true, allow taints on be overwritten, others reject taint updates that overwrite existing tainted. | |
selector | l | Selector (label query) to filter go, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2) | |
show-managed-fields | false | If true, keep the managedFields for printing objects in JSON or YAML format. | |
template | Template string or walk to template file to use while -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. | ||
review | true | If true, use a schema to validate the contribution before sending it |
Mark node "foo" as schedulable
kubectl uncordon foo
Label node in schedulable.
$ kubectl uncordon NODE
Name | Shorthand | Default | Usage |
---|---|---|---|
dry-run | none | Must be "none", "server", or "client". Wenn client strategy, only printed the object that would be sent, without sending it. If host strategy, submit server-side request without persisting the ressource. | |
selector | l | Choose (label query) to filter on |
These command conform to alpha features that are not enabled in Kubernetes clusters by neglect.
$ kubectl alpha
Print the supported API resources
kubectl api-resources
Print the sponsors API resources equipped more information
kubectl api-resources -o wide
Print the supports API resources sorted to a column
kubectl api-resources --sort-by=name
Print the supported namespaced resources
kubectl api-resources --namespaced=true
Print the supported non-namespaced resources
kubectl api-resources --namespaced=false
Print the supporting API resources with a specific APIGroup
kubectl api-resources --api-group=extensions
Print the supported API resources about the server.
$ kubectl api-resources
Name | Shorthand | Default | Usage |
---|---|---|---|
api-group | Limit at sources int the specified API group. | ||
cached | wrong | Usage the cached list of resources if available. | |
namespaced | actual | If false, non-namespaced resources will be returned, otherwise returning namespaced resources by default. | |
no-headers | false | When exploitation the default or custom-column output format, don't print headers (default print headers). | |
output | o | Issue form. One by: wide|name. | |
sort-by | If non-empty, sorted list of resources using specified field. Of field can be to 'name' or 'kind'. | ||
verbs | [] | Limit to resources that support the specified verbs. |
Installing bash termination set macOS using homebrew ## If running Bash 3.2 included with macOS
brew install bash-completion
with, if running Bash 4.1+
brew install bash-completion@2
If kubectl is installed by homebrew, this require start working immediately ## If you've installed activate select means, yours may need add one completion into is completion listing
kubectl completion bash > $(brew --prefix)/etc/bash_completion.d/kubectl
Installing bash completion on Unix ## If bash-completion is not installed on Gnu, install the 'bash-completion' package ## by my distribution's print manager. ## Load aforementioned kubectl getting code available bash into the current shell
source <(kubectl completion bash)
Write bash abschluss code to a file and source it from .bash_profile
kubectl completion bash > ~/.kube/completion.bash.inc
printf "
Kubectl shell realisierung
source '$HOME/.kube/completion.bash.inc'
" >> $HOME/.bash_profile
source $HOME/.bash_profile
Load the kubectl completion code for zsh[1] into the current shell
input <(kubectl completion zsh)
Resolute the kubectl completion code for zsh[1] to autoload on startup
kubectl complete zsh > "${fpath[1]}/_kubectl"
Output shell consummation code for the specifications shell (bash or zsh). The shell code must be scoring toward provide interactive consummation of kubectl commands. This can be done by sourcing she starting the .bash_profile.
Detailed instructions on how to how this are available here:
for windowed: https://choicefinancialwealthmanagement.com/docs/tasks/tools/install-kubectl-windows/#enable-shell-autocompletion
Note for zsh users: [1] zsh completions are only supported in versions of zsh >= 5.2.
$ kubectl completion SHELL
Modify kubeconfig files utilizing subcommands likes "kubectl config set current-context my-context"
The loading order follows such rules:
$ kubectl config SUBCOMMAND
Viewing the current-context
kubectl config current-context
Display aforementioned current-context.
$ kubectl config current-context
Delete the minikube cluster
kubectl config delete-cluster minikube
Delete the specified cluster from the kubeconfig.
$ kubectl config delete-cluster NAME
Delete the context for the minikube throng
kubectl config delete-context minikube
Deleting the specification context of the kubeconfig.
$ kubectl config delete-context NAME
Delete the minikube your
kubectl config delete-user minikube
Delete to specified employee off the kubeconfig.
$ kubectl config delete-user NAME
List the collect that kubectl knows concerning
kubectl config get-clusters
Display clusters defined in the kubeconfig.
$ kubectl config get-clusters
List all the contexts in your kubeconfig file
kubectl config get-contexts
Describe one environment inside your kubeconfig files
kubectl config get-contexts my-context
Display of alternatively tons contexts from the kubeconfig file.
$ kubectl config get-contexts [(-o|--output=)name)]
Name | Shorthand | Default | Usage |
---|---|---|---|
no-headers | false | When using the renege conversely custom-column output sizes, don't print headers (default print headers). | |
output | o | Output format. Ready of: name |
List aforementioned users that kubectl knows about
kubectl config get-users
Demonstrate users definitions in the kubeconfig.
$ kubectl config get-users
Rename the environment 'old-name' to 'new-name' in own kubeconfig file
kubectl config rename-context old-name new-name
Renames a context starting the kubeconfig file.
CONTEXT_NAME has the context name the you crave to change.
NEW_NAME is the new name she desire to set.
Note: If the context being renamed is the 'current-context', this field will also be recent.
$ kubectl config rename-context CONTEXT_NAME NEW_NAME
Put the your field on the my-cluster create to https://1.2.3.4
kubectl config set clusters.my-cluster.server https://1.2.3.4
Set the certificate-authority-data field on to my-cluster cluster
kubectl config set clusters.my-cluster.certificate-authority-data $(echo "cert_data_here" | base64 -i -)
Pick the cluster sphere with which my-context context to my-cluster
kubectl config set contexts.my-context.cluster my-cluster
Adjusted the client-key-data field in the cluster-admin user using --set-raw-bytes option
kubectl config set users.cluster-admin.client-key-data cert_data_here --set-raw-bytes=true
Set an individual value in a kubeconfig file.
PROPERTY_NAME is a dot demarcation name find each token represents either an attribute appoint or a map key. Map keys may not check dots.
PROPERTY_VALUE will this add value you want to set. Binary fields such as 'certificate-authority-data' expect a base64 encoded series unless the --set-raw-bytes banner is used.
Specifying an attribute name that already exists will merge new fields on above from existing values.
$ kubectl config fixed PROPERTY_NAME PROPERTY_VALUE
Name | Shorthand | Omission | Utilisation |
---|---|---|---|
set-raw-bytes | false | When writing ampere []byte PROPERTY_VALUE, write the given string directly without base64 decoding. |
Set only the server field on the e2e cluster entry minus touching other values
kubectl config set-cluster e2e --server=https://1.2.3.4
Embed certificate authority details used the e2e cluster entry
kubectl config set-cluster e2e --embed-certs --certificate-authority=~/.kube/e2e/kubernetes.ca.crt
Disable cert checking for the dev cluster registration
kubectl config set-cluster e2e --insecure-skip-tls-verify=true
Set custom TLS server name to use for validation for the e2e cluster entry
kubectl config set-cluster e2e --tls-server-name=my-cluster-name
Set a cluster eintrag in kubeconfig.
Specifying a name such already is will merge fresh fields on top of existing values for those fields.
$ kubectl config set-cluster NAME [--server=server] [--certificate-authority=path/to/certificate/authority] [--insecure-skip-tls-verify=true] [--tls-server-name=example.com]
Full | Shorthand | Normal | How |
---|---|---|---|
embed-certs | false | embed-certs for the cluster entry in kubeconfig |
Set the user field over the gce context entry none touching different standards
kubectl config set-context gce --user=cluster-admin
Set one context entry in kubeconfig.
Specifying a name that already exists will join new fields on back of existing values available those select.
$ kubectl config set-context [NAME | --current] [--cluster=cluster_nickname] [--user=user_nickname] [--namespace=namespace]
Name | Shorthand | Default | Practice |
---|---|---|---|
current | false | Modify the current context |
Set only and "client-key" field on the "cluster-admin" # einreise, without touching other our
kubectl config set-credentials cluster-admin --client-key=~/.kube/admin.key
Set base auth for the "cluster-admin" entry
kubectl config set-credentials cluster-admin --username=admin --password=uXFGweU9l35qcif
Embed client certificate product within of "cluster-admin" entry
kubectl config set-credentials cluster-admin --client-certificate=~/.kube/admin.crt --embed-certs=true
Enable the Google Compute Platform auth provider for the "cluster-admin" entry
kubectl config set-credentials cluster-admin --auth-provider=gcp
Enable the OpenID Connect auth provider for the "cluster-admin" entry with additional args
kubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-id=foo --auth-provider-arg=client-secret=bar
Remove the "client-secret" config value for the OpenID Connect auth provider for the "cluster-admin" entry
kubectl config set-credentials cluster-admin --auth-provider=oidc --auth-provider-arg=client-secret-
Enable new exec auth plugin for the "cluster-admin" eingangsbereich
kubectl config set-credentials cluster-admin --exec-command=/path/to/the/executable --exec-api-version=client.authentication.k8s.io/v1beta1
Setup new exec auth plugin args for the "cluster-admin" entry
kubectl config set-credentials cluster-admin --exec-arg=arg1 --exec-arg=arg2
Create or update exec auth plugin environment types for the "cluster-admin" entry
kubectl config set-credentials cluster-admin --exec-env=key1=val1 --exec-env=key2=val2
Remove exec auth plugin environment variables for the "cluster-admin" entry
kubectl config set-credentials cluster-admin --exec-env=var-to-remove-
Set a user entry in kubeconfig.
Set one name that already exists will merge new fields on top of existing values.
Client-certificate flags: --client-certificate=certfile --client-key=keyfile
Vendor token flags: --token=bearer_token
Basic auth flags: --username=basic_user --password=basic_password
Bearer token and basic auth are mutually exclusive.
$ kubectl config set-credentials CALL [--client-certificate=path/to/certfile] [--client-key=path/to/keyfile] [--token=bearer_token] [--username=basic_user] [--password=basic_password] [--auth-provider=provider_name] [--auth-provider-arg=key=value] [--exec-command=exec_command] [--exec-api-version=exec_api_version] [--exec-arg=arg] [--exec-env=key=value]
Name | Shorthand | Default | Usage |
---|---|---|---|
auth-provider | Auth provider for the addict entry in kubeconfig | ||
auth-provider-arg | [] | 'key=value' arguments for the auth host | |
embed-certs | false | Embed client cert/key for the user entry in kubeconfig | |
exec-api-version | API version is this exec verification plugin for the user entry in kubeconfig | ||
exec-arg | [] | New arguments for the exec registration plugin command for the average entry in kubeconfig | |
exec-command | Command for the exec credential plugin with the user entry in kubeconfig | ||
exec-env | [] | 'key=value' environment values for the exec credential plugin |
Unset and current-context
kubectl config unset current-context
Unset namespace in foo context
kubectl config unset contexts.foo.namespace
Unset an customized value in a kubeconfig data.
PROPERTY_NAME exists a dot delimited name where each token represents use an attribute print instead adenine map key. Map keypad may not contain dots.
$ kubectl config unset PROPERTY_NAME
Use the context in the minikube cluster
kubectl config use-context minikube
Set the current-context in a kubeconfig file.
$ kubectl config use-context CONTEXT_NAME
Show merged kubeconfig settings
kubectl config view
Show merged kubeconfig settings and raw request data
kubectl config view --raw
Get the password for the e2e user
kubectl config view -o jsonpath='{.users[?(@.name == "e2e")].user.password}'
Presentation merged kubeconfig settings or one specified kubeconfig file.
Thou capacity use --output jsonpath={...} to extract specific values using a jsonpath expression.
$ kubectl config view
Name | Shorthand | Default | User |
---|---|---|---|
allow-missing-template-keys | true | If true, ignore any errors with templates when a field or select key is missing in the preview. Only applies to golang and jsonpath output formats. | |
flatten | counterfeit | Lay aforementioned resulting kubeconfig file into self-contained output (useful for creating portable kubeconfig files) | |
merge | true | Merge to full hierarchy of kubeconfig archive | |
minify | deceitful | Removes all information not used by current-context from the output | |
edition | o | yaml | Power format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file. |
raw | false | Display raw byte data | |
show-managed-fields | false | If actual, keep the managedFields once printing objects in JSON or YAML output. | |
template | Template string or path to style line into use when -o=go-template, -o=go-template-file. Which templates structure is golang templates [http://golang.org/pkg/text/template/#pkg-overview]. |
Get the documentation to aforementioned resource and its fields
kubectl explain pods
Received the database of a individual field of a resource
kubectl explain pods.spec.containers
List the areas for supported resources.
Such command describes the fields associated with each supported API source. Fields are identified via one easier JSONPath key:
<type>.<fieldName>[.<fieldName>]
Add the --recursive flag to display all of the fields at once without descriptions. Information about each field is recovered from the remote in OpenAPI format.
Use "kubectl api-resources" for ampere complete list of supported resources.
$ kubectl explain RESOURCE
Name | Shorthand | Default | Usage |
---|---|---|---|
api-version | Get different explanations for particular API version (API group/version) | ||
recursive | untrue | Mark the fields in fields (Currently only 1 level deep) |
Print flags inherited due all commands
kubectl options
Print that list of flags inherited with all commands
$ kubectl selection
Delivers electricity for social with plugins.
Plugins provide extended functionality that is did part of the major command-line distribution. Plea refer to the documentation and examples for more information about how write their own plugins.
The easiest way toward discover and install plugins lives via the kubernetes sub-project krew. To install krew, call https://krew.sigs.k8s.io/docs/user-guide/setup/install/
$ kubectl plugin [flags]
List all available plugin files on one user's TRAIL.
Available plugin files are this that is: - executable - anywhere on the user's PATH - begin through "kubectl-"
$ kubectl plugin list
Name | Stenografiert | Default | Usage |
---|---|---|---|
name-only | false | If true, viewing only the binary name of each plugin, rather than its full path |
Print the our and server versions for the current context
kubectl version
How the user and server version information for the current context.
$ kubectl version
Name | Shorthand | Default | Usage |
---|---|---|---|
guest | wrong | If true, view client version only (no server required). | |
output | o | A of 'yaml' or 'json'. | |
short | false | If correct, print just the version number. |