kubectl –help

kubectl –help

On this post, I will continue to add kubctl commands which are in regular use of mine

On Hello World of Kubectl, let’s do first kubectl –help

London:Downloads esumit$ kubectl –help

kubectl controls the Kubernetes cluster manager.

Find more information at: https://kubernetes.io/docs/reference/kubectl/overview/

Basic Commands (Beginner):

  create         Create a resource from a file or from stdin.

  expose         Take a replication controller, service, deployment or pod and expose it as a new

Kubernetes Service

  run            Run a particular image on the cluster

  set            Set specific features on objects

Basic Commands (Intermediate):

  explain        Documentation of resources

  get            Display one or many resources

  edit           Edit a resource on the server

  delete         Delete resources by filenames, stdin, resources and names, or by resources and

label selector

Deploy Commands:

  rollout        Manage the rollout of a resource

  scale          Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job

  autoscale      Auto-scale a Deployment, ReplicaSet, or ReplicationController

Cluster Management Commands:

  certificate    Modify certificate resources.

  cluster-info   Display cluster info

  top            Display Resource (CPU/Memory/Storage) usage.

  cordon         Mark node as unschedulable

  uncordon       Mark node as schedulable

  drain          Drain node in preparation for maintenance

  taint          Update the taints on one or more nodes

Troubleshooting and Debugging Commands:

  describe       Show details of a specific resource or group of resources

  logs           Print the logs for a container in a pod

  attach         Attach to a running container

  exec           Execute a command in a container

  port-forward   Forward one or more local ports to a pod

  proxy          Run a proxy to the Kubernetes API server

  cp             Copy files and directories to and from containers.

  auth           Inspect authorization

Advanced Commands:

  diff           Diff live version against would-be applied version

  apply          Apply a configuration to a resource by filename or stdin

  patch          Update field(s) of a resource using strategic merge patch

  replace        Replace a resource by filename or stdin

  wait           Experimental: Wait for a specific condition on one or many resources.

  convert        Convert config files between different API versions

  kustomize      Build a kustomization target from a directory or a remote url.

Settings Commands:

  label          Update the labels on a resource

  annotate       Update the annotations on a resource

  completion     Output shell completion code for the specified shell (bash or zsh)

Other Commands:

  api-resources  Print the supported API resources on the server

  api-versions   Print the supported API versions on the server, in the form of “group/version”

  config         Modify kubeconfig files

  plugin         Provides utilities for interacting with plugins.

  version        Print the client and server version information

Usage:

  kubectl [flags] [options]

Use “kubectl <command> –help” for more information about a given command.

London:Downloads esumit$  kubectl create –help

Create a resource from a file or from stdin.

JSON and YAML formats are accepted.

Examples:

  # Create a pod using the data in pod.json.

  kubectl create -f ./pod.json

  

  # Create a pod based on the JSON passed into stdin.

  cat pod.json | kubectl create -f –

  

  # Edit the data in docker-registry.yaml in JSON then create the resource using the edited data.

  kubectl create -f docker-registry.yaml –edit -o json

Available Commands:

  clusterrole         Create a ClusterRole.

  clusterrolebinding  Create a ClusterRoleBinding for a particular ClusterRole

  configmap           Create a configmap from a local file, directory or literal value

  cronjob             Create a cronjob with the specified name.

  deployment          Create a deployment with the specified name.

  job                 Create a job with the specified name.

  namespace           Create a namespace with the specified name

  poddisruptionbudget Create a pod disruption budget with the specified name.

  priorityclass       Create a priorityclass with the specified name.

  quota               Create a quota with the specified name.

  role                Create a role with single rule.

  rolebinding         Create a RoleBinding for a particular Role or ClusterRole

  secret              Create a secret using specified subcommand

  service             Create a service using specified subcommand.

  serviceaccount      Create a service account with the specified name

Options:

      –allow-missing-template-keys=true: If true, ignore any errors in templates when a field or

map key is missing in the template. Only applies to golang and jsonpath output formats.

      –dry-run=false: If true, only print the object that would be sent, without sending it.

      –edit=false: Edit the API resource before creating

  -f, –filename=[]: Filename, directory, or URL to files to use to create the resource

  -k, –kustomize=”: Process the kustomization directory. This flag can’t be used together with -f

or -R.

  -o, –output=”: Output format. One of:

json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.

      –raw=”: Raw URI to POST to the server.  Uses the transport specified by the kubeconfig file.

      –record=false: Record current kubectl command in the resource annotation. If set to false, do

not record the command. If set to true, record the command. If not set, default to updating the

existing annotation value only if one already exists.

  -R, –recursive=false: Process the directory used in -f, –filename recursively. Useful when you

want to manage related manifests organized within the same directory.

      –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 on this object in the future.

  -l, –selector=”: Selector (label query) to filter on, supports ‘=’, ‘==’, and ‘!=’.(e.g. -l

key1=value1,key2=value2)

      –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].

      –validate=true: If true, use a schema to validate the input before sending it

      –windows-line-endings=false: Only relevant if –edit=true. Defaults to the line ending native

to your platform.

Usage:

  kubectl create -f FILENAME [options]

Use “kubectl <command> –help” for more information about a given command.

Use “kubectl options” for a list of global command-line options (applies to all commands).

London:Downloads esumit$

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s