Boosting your kubectl productivity ♦︎ Learnk8s - 0 views
-
kubectl is your cockpit to control Kubernetes.
- ...75 more annotations...
-
every Kubernetes operation is exposed as an API endpoint and can be executed by an HTTP request to this endpoint.
-
Kubernetes maintains an internal state of resources, and all Kubernetes operations are CRUD operations on these resources.
-
it's totally possible to control Kubernetes with a tool like curl by manually issuing HTTP requests to the Kubernetes API.
-
Kubernetes consists of a set of independent components that run as separate processes on the nodes of a cluster.
-
The kubelet of the worker node your ReplicaSet Pods have been scheduled to instructs the configured container runtime (which may be Docker) to download the required container images and run the containers.
-
Kubernetes components (except the API server and the storage backend) work by watching for resource changes in the storage backend and manipulating resources in the storage backend.
-
However, these components do not access the storage backend directly, but only through the Kubernetes API.
-
double usage of the Kubernetes API for internal components as well as for external users is a fundamental design concept of Kubernetes.
-
All other Kubernetes components and users read, watch, and manipulate the state (i.e. resources) of Kubernetes through the Kubernetes API
-
A completion script is a shell script that defines the completion behaviour for a specific command. Sourcing a completion script enables completion for the corresponding command.
-
displays the resource names in their plural form (e.g. deployments instead of deployment). It also displays the shortname (e.g. deploy) for those resources that have one. Don't worry about these differences. All of these name variants are equivalent for kubectl.
-
custom columns output format comes in. It lets you freely define the columns and the data to display in them. You can choose any field of a resource to be displayed as a separate column in the output
-
Many fields of Kubernetes resources are lists, and this operator allows you to select items of these lists. It is often used with a wildcard as [*] to select all items of the list.
-
The availability zones for each node are obtained through the special failure-domain.beta.kubernetes.io/zone label.
-
with multiple clusters, then you have connection parameters for multiple clusters configured in your kubeconfig file.
-
Within a cluster, you can set up multiple namespaces (a namespace is kind of "virtual" clusters within a physical cluster)
-
to switch to another namespace in the same cluster, you can change the value of the namespace element of the current context
-
kubectl also provides the --cluster, --user, --namespace, and --context options that allow you to overwrite individual elements and the current context itself, regardless of what is set in the kubeconfig file.
-
just have to download the shell scripts named kubectl-ctx and kubectl-ns to any directory in your PATH and make them executable (for example, with chmod +x)
-
Kubectl plugins are distributed as simple executable files with a name of the form kubectl-x. The prefix kubectl- is mandatory,
-
To install a plugin, you just have to copy the kubectl-x file to any directory in your PATH and make it executable (for example, with chmod +x)
-
The executable can be of any type, a Bash script, a compiled Go program, a Python script, it really doesn't matter. The only requirement is that it can be directly executed by the operating system.
-
you can write more sophisticated plugins with real programming languages, for example, using a Kubernetes client library. If you use Go, you can also use the cli-runtime library, which exists specifically for writing kubectl plugins.
-
changing the current context means changing the cluster, if you have only a single context per cluster.