{"id":14956,"date":"2022-02-04T10:33:12","date_gmt":"2022-02-04T10:33:12","guid":{"rendered":"https:\/\/linuxways.net\/?p=14956"},"modified":"2022-02-04T10:33:12","modified_gmt":"2022-02-04T10:33:12","slug":"kubectl-get-command-explained-with-examples","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/kubectl-get-command-explained-with-examples\/","title":{"rendered":"&#8216;kubectl get&#8217; Command Explained with Examples"},"content":{"rendered":"<p>Kubernetes is an open-source platform that is the most portable for managing containerized workloads and services. It works as an automation tool by providing the services, support and tools that are widely available.<\/p>\n<p>Whereas, Kubectl controls the Kubernetes Cluster as it is one of the key components of Kubernetes having the capability to manage the nodes in the cluster. Kubectl get command is capable of fetching the related data on the cluster about the Kubernetes resources.<\/p>\n<p>In this article, we are going to discuss the use of the \u2018Kubectl get\u2019 command with some examples.<\/p>\n<h2>Kubectl get commands<\/h2>\n<p>Some of the important kubectl get commands to fetch the data on the cluster about the Kubernetes resources are listed below.<\/p>\n<h3>Kubectl get pod<\/h3>\n<p>To get the details about the pod of the container of the related kubernetes cluster, there is a command similar to the command as:<\/p>\n<p>To get the list of all the pods available on default namespace, run the command as shown below.<\/p>\n<pre>$ kubectl get pod<\/pre>\n<p>But to get the details of the specific pod, you can enter the pod name as:<\/p>\n<pre>$ kubectl get pod &lt;pod name&gt;<\/pre>\n<p><strong>Example<\/strong>:<\/p>\n<pre>$ kubectl get pod nginx-http-6cf5c9bf86-p5q2x<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"574\" height=\"55\" class=\"wp-image-14957\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-214.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-214.png 574w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-214-300x29.png 300w\" sizes=\"auto, (max-width: 574px) 100vw, 574px\" \/><\/p>\n<p>Here, the pod name is \u201cnginx-http-6cf5c9bf86-p5q2x\u201d. It will display all the details regarding the specific pod.<\/p>\n<h3>Kubectl get deployment<\/h3>\n<p>To get the details about the deployments of the container of the related kubernetes cluster, there is a command similar to the command as:<\/p>\n<p>To get the list of all the deployments available on default namespace, run the command as shown below.<\/p>\n<pre>$ kubectl get deployment<\/pre>\n<p>But to get the details of the specific deployment, you can enter the deployment name as:<\/p>\n<pre>$ kubectl get deployment &lt;deployment name&gt;<\/pre>\n<p><strong>Example<\/strong>:<\/p>\n<pre>$ kubectl get deployment nginx-http<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"587\" height=\"57\" class=\"wp-image-14958\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-215.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-215.png 587w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-215-300x29.png 300w\" sizes=\"auto, (max-width: 587px) 100vw, 587px\" \/><\/p>\n<p>Here, the deployment name is \u201cnginx-http\u201d. It will display all the details regarding the specific deployment.<\/p>\n<h3>Kubectl get service<\/h3>\n<p>To get the details about the service of the container of the related kubernetes cluster, there is a command similar to the command as:<\/p>\n<p>To get the list of all the services available on default namespace, run the command as shown below.<\/p>\n<pre>$ kubectl get service<\/pre>\n<p>But to get the details of the specific service, you can enter the service name as:<\/p>\n<pre>$ kubectl get service &lt;service name&gt;<\/pre>\n<p><strong>Example<\/strong>:<\/p>\n<pre>$ kubectl get service nginx-http-svc<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"754\" height=\"55\" class=\"wp-image-14959\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-216.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-216.png 754w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-216-300x22.png 300w\" sizes=\"auto, (max-width: 754px) 100vw, 754px\" \/><\/p>\n<p>Here, the service name is \u201cnginx-http-svc\u201d. It will display all the details regarding the specific service.<\/p>\n<h3>Kubectl get ingress<\/h3>\n<p>To get the details about the ingress of the container of the related kubernetes cluster, there is a command similar to the command as:<\/p>\n<p>To get the list of all the ingress available on default namespace, run the command as shown below.<\/p>\n<pre>$ kubectl get ingress<\/pre>\n<p>But to get the details of the specific ingress, you can enter the ingress name as:<\/p>\n<pre>$ kubectl get ingress &lt;ingress name&gt;<\/pre>\n<p><strong>Example<\/strong>:<\/p>\n<pre>$ kubectl get ingress ingress-nginx<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"58\" class=\"wp-image-14960\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-217.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-217.png 622w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-217-300x28.png 300w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/p>\n<p>Here, the ingress name is \u201cingress-nginx\u201d. It will display all the details regarding the specific ingress.<\/p>\n<h3>Kubectl get configmap<\/h3>\n<p>To get the details about the configmap of the container of the related kubernetes cluster, there is a command similar to the command as:<\/p>\n<p>To get the list of all the configmap available on default namespace, run the command as shown below.<\/p>\n<pre>$ kubectl get configmap<\/pre>\n<p>But to get the details of the specific configmap, you can enter the config name as:<\/p>\n<pre>$ kubectl get configmap &lt;configmap name&gt;<\/pre>\n<p><strong>Example<\/strong>:<\/p>\n<pre>$ kubectl get configmap nginx-http-cm<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"544\" height=\"55\" class=\"wp-image-14961\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-218.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-218.png 544w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-218-300x30.png 300w\" sizes=\"auto, (max-width: 544px) 100vw, 544px\" \/><\/p>\n<p>Here, the configmap name is \u201cnginx-http-cm\u201d. It will display all the details regarding the specific configmap.<\/p>\n<h3>Kubectl get secrets<\/h3>\n<p>To get the details about the secrets of the container of the related kubernetes cluster, there is a command similar to the command as:<\/p>\n<p>To get the list of all the secrets available on default namespace, run the command as shown below.<\/p>\n<pre>$ kubectl get secrets<\/pre>\n<p>But to get the details of the specific secrets, you can enter the secrets name as:<\/p>\n<pre>$ kubectl get secrets &lt;secrets name&gt;<\/pre>\n<p><strong>Example<\/strong>:<\/p>\n<pre>$ kubectl get secrets default-token-xct8s<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"654\" height=\"56\" class=\"wp-image-14962\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-219.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-219.png 654w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-219-300x26.png 300w\" sizes=\"auto, (max-width: 654px) 100vw, 654px\" \/><\/p>\n<p>Here, the secret name is \u201cdefault-token-xct8s\u201d. It will display all the details regarding the specific secrets.<\/p>\n<h3>Kubectl get namespace<\/h3>\n<p>To get the details about the namespace of the container of the related kubernetes cluster, there is a command similar to the command as:<\/p>\n<pre>$ kubectl get namespace &lt;namespace name&gt;<\/pre>\n<p><strong>Example<\/strong>:<\/p>\n<pre>$ kubectl get namespace<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"586\" height=\"109\" class=\"wp-image-14963\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-220.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-220.png 586w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/02\/word-image-220-300x56.png 300w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/p>\n<p>Here, we are using the default namespace. By running the command as \u201ckubectl get namespace\u201d, we are listing all the available namespace.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this article, you have learnt how to use the \u201ckubectl get command\u201d with different options like pods, deployment, services, etc. It will fetch the related data on the cluster about the Kubernetes resources.<\/p>","protected":false},"excerpt":{"rendered":"<p>Kubernetes is an open-source platform that is the most portable for managing containerized workloads and services. It works as an automation tool by providing the services, support and&hellip;<\/p>","protected":false},"author":1,"featured_media":14977,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,891,5,83,165,2],"tags":[901],"class_list":["post-14956","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-manjaro","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-kubectl-get"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/14956","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=14956"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/14956\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/14977"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=14956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=14956"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=14956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}