Kubernetes has quickly grown to become one of the most popular container orchestration frameworks in the industry. Kubernetes has many benefits and it known for its flexibility and ease of use. With its growing community, many tools and technologies have been developed to make it simple to use.
kubectl describe used for?
As is evident by its name, the
kubectl describe command is used to view details of a Kubernetes resource or resource group. Here's how it's used:
Common resource types include pods, services, nodes, events, and more. The command takes the prefix of the resource name as input. You can also provide the complete name of the resource and it would work just fine.
Here's how you can use this command:
Here's what the output would look like:
Exploring kubectl describe in detail
kubectl describe command provides a few options to tailor it to your liking. Here are some of those:
Viewing by label
You can also use metadata labels to filter and identify resources when describing them. Here's what the syntax looks like for that:
Viewing resources using a file
The `kubectl describe` command allows you to query for resources using data stored in a file. Here's what the syntax looks like:
You can use the following syntax too:
It works the same as the syntax shared at the beginning of the article.
Kubectl describe vs. kubectl get
People often debate on whether or not
describe was needed when there already was a
get command. To understand this better, let's try to view them side by side:
Here's what a
get command on a pod returns:
~> kubectl get pod test-webapp-d5f9b9d8d-flqjk
Here's what a
describe call on the same pod returns:
As you can see, the get command (by default) returns a very quick summary of the status of the resource in question. On the other hand, the describe command prepares a detailed summary of the resource with additional details like container ID, limits, node details, etc.
get command returns the information in a tabular fashion by default. You also have the option to view the information in any other format such as JSON or YAML by passing it as an option. But, the output returned in such a case is quite verbose and is usually difficult to read.
At the end of the day,
describe provides you with just the right amount of information about your K8s resource. If you are looking for anything less or more, you should look towards
K8s is one of the popular container-orchestration technologies in use right now. The
kubectl describe command enables developers to look into the current state of their Kubernetes resources. In this guide, we showed you how to use this command as well as contrasted it with another popular command that does a similar job.
To build an internal dashboard that makes it easy to monitor your Kubernetes resources, consider using Airplane. With Airplane, you can quickly transform scripts, queries, APIs, and more into powerful workflows and UIs using code. Airplane's engineering workflows solution can help you build robust internal tools within minutes for your most important engineering-centric use cases.