0% found this document useful (0 votes)
15 views11 pages

Five Forgotten Kubectl Commands 1680104793

The document highlights five lesser-known kubectl commands that can enhance user interaction with Kubernetes clusters. These commands include 'explain' for resource documentation, 'api-resources' for listing available API resources, 'config' for modifying kubeconfig files, 'cp' for copying files to and from containers, and 'replace' for replacing Kubernetes resources. The author, Jakub Krzywda, is a Senior Cloud Native Engineer and encourages readers to engage with him on the topic of Kubernetes and related technologies.

Uploaded by

RuiValentimRusso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views11 pages

Five Forgotten Kubectl Commands 1680104793

The document highlights five lesser-known kubectl commands that can enhance user interaction with Kubernetes clusters. These commands include 'explain' for resource documentation, 'api-resources' for listing available API resources, 'config' for modifying kubeconfig files, 'cp' for copying files to and from containers, and 'replace' for replacing Kubernetes resources. The author, Jakub Krzywda, is a Senior Cloud Native Engineer and encourages readers to engage with him on the topic of Kubernetes and related technologies.

Uploaded by

RuiValentimRusso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

JAKUB KRZYWDA

@jakubkrzywda

Five forgotten

KUBECTL COMMANDS

You wish you


knew them
before!
kubectl is the Kubernetes
command-line tool.
It allows you to directly interact
with Kubernetes clusters!
Typically, kubectl is used to:
● deploy applications
● inspect and manage cluster
resources
● view logs
There are however a few more
commands that often stay
unnoticed even though they
might be very useful…

Here I list my favourite five…


1. explain

Get documentation of Kubernetes


resources. Dig deeper within their
structure using a YAML path expression.
For example:
kubectl explain service.spec.type

will provide you with a list of possible


Service types and their descriptions!
2. api-resources

List the API resources available in the


Kubernetes cluster.
Filter them by scope, API group, etc.
For example:
kubectl api-resources \
--namespaced=false

will give you a list of all cluster wide API


resources installed in your cluster.
3. config

Modify kubeconfig file.

For example:
kubectl config set-context \
--current \
--namespace mynamespace

changes the namespace that the following


kubectl commands will default to.
4. cp

Copy files and directories to and from


containers.
For example:
kubectl cp my-local-file \
my-pod:/tmp/my-file \
-c my-container

will copy my-local-file to


my-container running inside my-pod
at /tmp/my-file location.
5. replace

Directly replace a Kubernetes resource.

For example:
kubectl replace -f mypod.yaml --force

will delete the matching Pod and replace it


with a new Pod according to the
specification in mypod.yaml file.
JAKUB KRZYWDA
@jakubkrzywda

THAT’S IT FOR TODAY!

My name is Jakub Krzywda.

I’m a Senior Cloud Native Engineer and


Kubernetes Trainer.

I post about: Kubernetes, Cloud Native


technologies and DevOps practices.
JAKUB KRZYWDA
@jakubkrzywda

WHAT DO YOU THINK?


Did you know about any of these commands?

Are there any other “forgotten” kubectl commands


that you find useful?

Remember
to click
follow + 🔔

You might also like