Certified Kubernetes Administrator - Introduction to the kubectl command

The objective of this post series helps you for taking the Certified Kubernetes Administrator (CKA) exam using Kubernetes Official Documentation. You don't need to install  Kubernetes  Cluster for the test that we performed on these posts. You can practice a lot with kubectl API using Katacoda.

 

Overview Of kubectl Command

Kubectl is a command-line interface for running commands against Kubernetes clusters. You can manage your apps and cluster and cluster resources by kubectl command. If you have already installed Kubernetes Cluster and you want to use kubectl command to manage it then check this link to install and configure kubectl command. But at this post, I will basically describe how to use it over Katacoda.

Kubectl commands use Kubeconfigfile to store Kubernetes cluster information. Basically this config file stores every information that you need to connect and run commands against the Kubernetes cluster. I want to add some information about the Kubeconfig file that helps you to understand how it works. 

Kubeconfig YAML file has three objects that Clusters, Contexts, Users.

  • Clusters: This is the object that you will define your cluster information like production, test, disaster, etc. 
  • Users: User information that will be used to manage the resources.
  • Contexts: A context is a group of access parameters. Each context contains a Kubernetes cluster, a user, and a namespace. It's important that namespaces parameters must be defined in contexts.

Basic kubeconfigfile example;


apiVersion: v1
kind: Config

clusters:
- name: Production
  cluster:
    certificate-authority: /etc/kubernetes/pki/ca.crt
    server: https://172.17.0.35:6443

contexts:
- name: admin@Production
  context:
    cluster: Production
    user: admin
    namespace: Billing

users:
- name: admin
  user:
    client-certificate: /etc/kubernetes/pki/users/test-user/test-user.crt
    client-key: /etc/kubernetes/pki/users/test-user/test-user.key
current-context: admin@Production

 

You can get this information from config file located under ".kube" directory and also with kubectl command.

 

#cat ~/.kube/config

OR:

#kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: REDACTED
    server: https://172.17.0.35:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED

 

Time to test your skills. Use  Katacoda and find out the answers.

Question 1:  How to get current-context and configuration?

#kubectl config current-context
kubernetes-admin@kubernetes
# kubectl config view
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: REDACTED
    server: https://172.17.0.35:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED

Question 2:  How to change current-context?

#kubectl config get-contexts
CURRENT   NAME                          CLUSTER      AUTHINFO           NAMESPACE
*         kubernetes-admin@kubernetes   kubernetes   kubernetes-admin

#kubectl  config  use-context kubernetes-admin@kubernetes
Switched to context "kubernetes-admin@kubernetes".

Question 3:  How to get Kubernetes cluster information?

#kubectl  cluster-info
Kubernetes master is running at https://172.17.0.11:8443
KubeDNS is running at https://172.17.0.11:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

#kubectl  version 
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:20:10Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:12:17Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"} 

-- To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. 
#kubectl cluster-info dump

Question 4:  How to get running node information?

-- To further information about node and running software versions.
#kubectl get nodes -o yaml
#kubectl  get  node -o wide
NAME       STATUS   ROLES    AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
minikube   Ready    master   23m   v1.17.0   172.17.0.11   <none>        Ubuntu 18.04.3 LTS   4.15.0-72-generic   docker://18.9.7

Question 5:  How to get running pods?

#kubectl get pods --all-namespaces

I'm a IT Infrastructure and Operations Architect with extensive experience and administration skills and works for Turk Telekom. I provide hardware and software support for the IT Infrastructure and Operations tasks.

205 Total Posts
Follow Me

831 Comments

  1. Generic! Smile more. people what is in cialis See you in New Year USA 2020 Buy Cialis cheap

  2. A próxima lanço é controle químico do envolvente.

  3. Amazing! Its really amazing post, I have got much clear idea concerning from this article.

  4. I have been surfing online more thjan 3 hours as of late, but I never discovered any attention-grabbing article like yours. It's beautiful price enough for me. In my view, if all web owners and bloggers made excellent content material aas you probably did, the internet can be much moore useful than ever before.

  5. Have you ever thought about including a little bit ore than just your articles? I mean, what youu sayy is valuable and all. Nevertheless imagone iff you added some great visuas oor video clips to give your posts more, "pop"! Your content iis excellent but with pics andd clips, this skte could definitely be one off thhe most beneficial in itss field. Amazing blog!

  6. Good day! Do you know if they make any pluginns to help with SEO? I'm trying to get my blog to rank for some targeted keywords but I'm not seeing very good gains. If you know of any please share. Many thanks!

  7. Hello. And Bye. http://www.viagra-online-withoutprescription.org/ viagra-online-withoutprescription.org

  8. Hello. And Bye. http://www.viagra-online-withoutprescription.org/ viagra-online-withoutprescription.org

  9. Hello. And Bye. http://www.viagra-online-withoutprescription.org/ viagra-online-withoutprescription.org viagra online

  10. It is appropriate time to make a few plans for the longer term and it is time to be happy. I've read this submit and if I may I wish to counsel you few interesting things or tips. Perhaps you could write next articles relating to this article. I wish to read even more issues about it! research paper writing service https://essaywritingtld.com/

  11. This piece of writing is really a good one it assists new web viewers, who are wishing for blogging. write my paper for me https://essayhelpforall.com/

  12. Thanks , I have recently been looking for information approximately this subject for ages and yours is the best I have came upon so far. However, what about the conclusion? Are you positive in regards to the supply? writing pages https://essayservicesall.com/

  13. Hey just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Opera. I'm not sure if this is a formatting issue or something to do with web browser compatibility but I figured I'd post to let you know. The design and style look great though! Hope you get the problem fixed soon. Kudos write an essay https://allbestessaywritingservice.com/

  14. I know this if off topic but I'm looking into starting my own blog and was wondering what all is required to get set up? I'm assuming having a blog like yours would cost a pretty penny? I'm not very web savvy so I'm not 100% certain. Any tips or advice would be greatly appreciated. Thanks buy an essay https://essaywritingusauk.com/

  15. Good day! This post couldn't be written any better! Reading this post reminds me of my old room mate! He always kept chatting about this. I will forward this article to him. Fairly certain he will have a good read. Thanks for sharing! writing an essay https://essaywritingtld.com/

  16. I'm really impressed with your writing skills as well as with the layout on your blog. Is this a paid theme or did you customize it yourself? Either way keep up the nice quality writing, it's rare to see a great blog like this one these days. write my papers https://onlineessayforyou.com/

  17. Pretty! This was a really wonderful article. Thanks for providing these details. college persuasive essay https://buyessayscc.com/

  18. I am regular visitor, how are you everybody? This piece of writing posted at this site is truly nice. a persuasive essay https://essayservicesall.com/

  19. I havfe read so many articles concerning the bloggwr lovers but this paragraph is really a fastidious paragraph, keep it up. write my essays https://bestessaywritingservice.info/autism-and-writing-essays.html

  20. This paragraph is in fact a nice one it helps new net users, who are wishing for blogging. college essay help https://essaymeaning5579.weebly.com/blog/cheap-essay-writing-service-at-10-eight

  21. Hi there, I enjoy reading through your article. I wanted to write a little comment to support you. argument essay https://aboutessaywriting296.blogspot.com/2020/09/psychoanalysis-on-great-gatsby-essay.html

  22. You can definitely see your enthusiasm in the articlpe you write. The sector hopes for even more passionate writeds such as you who aren't afraid to say hoow they believe. At all times go after your heart. term paper help https://allbestessaywritingservice.com

  23. Today, I went to the beachfront with my kids. I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is totally off topic but I had to tell someone! someone write my paper https://buyessayscc.com/

  24. And sexually matured in return as forewarning as orchestra cialis ed dosage Discomfort Duro Rehab Thickening-25 Fibrous Beat Can Merely Out Mr.

  25. Every weekend i used to go to see this web site, for the reason that i want enjoyment, for the reason that this this site conations actually fastidious funny data too. buy cialis online with no prescription

  26. Hi! Do you know if they make any plugins to help with Search Engine Optimization? I'm trying to get myy blog to rank foor some targeted keywords but I'm not seeing very ood gains. If you know of any please share. Thanks! write a paper https://professionalessaywritingservice.com

  27. require reckoning Elderly In for the treatment of the hospital. cheap au cialis soft I’ve needed with our CS a few data to get.

  28. Thanks for sharing your thoughts on best price cialis online. Regards https://comprarcialis5mgonline.com/marca-cialis-professional-20-mg.html buy cialis online for cheap

  29. Saved as a favorite, I like your web site! https://comprarcialis5mgonline.com/marca-cialis-professional-20-mg.html legit cialis online

  30. Heya i'm for the first time here. I came across this board and I to find It really helpful & it helped me out much. I hope to give something back and aid others such as you helped me. Buy custom college essay online https://paper-writers37.tistory.com/1

  31. We are a group of volunteers and starting a new scheme in our community. Your site provided us with valuable information to wordk on. You've done a formidable job and our entire community will be thankful to you. help me with my essay https://buyresearchpaper2692.weebly.com/blog/a-professional-writer-and-journalists-text-editor

  32. can't look as if to identify anything to disability the. buy clomid now online Rurhrw xnmnel cialis drugs tadalafil online canadian pharmacy

  33. get lasix online where to buy lasix in Phoenix order usa lasix online http://lasifurex.com/ buy lasix in Hungary purchase lasix from Israel buy lasix on line buy lasix with free samples cheap lasix pills cheap lasix in Sweden top 3 best places to buy lasix in Nashville-Davidson lasix online pharmacy in Buffalo

  34. how to buy lasix in Portugal lasix samples in canada top 9 best places to buy lasix in Netherlands http://lasifurex.com/ how to buy lasix in Baltimore where to buy lasix in Buffalo online cost of lasix medication best price for lasix in Oakland buy lasix in Boston how to buy lasix in Baltimore generic lasix next day delivery where to buy lasix in Indianapolis online

  35. Fantastic beat ! I would like to apprentice while you amend your website, how can i subscribe forr a blig website? Thee account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided bright clear idea https://castlewritingpaper269.blogspot.com help me write my research paper help me write my research paper https://writingaparisonpaper980.blogspot.com/2020/09/best-essay-writing-services-from.html

  36. Why viewers still make use of to read news papers when in this technological world all is presented on net? https://comprarcialis5mgonline.com/marca-cialis-professional-20-mg.html buy cialis online canadian pharmacy

  37. Generally I don't read post on blogs, but I wish tto say thaqt this write-up very forced me to try and do so! Your writing style has been surprised me. Thak you, very great post. https://buyessaypapers334.blogspot.com/2020/09/prowritingaid-e.html write my essay write mmy essay https://sociologyresearchpaper3852.weebly.com/blog/specialty-writing-papers-handwriting-programs

  38. Do yoou have a spam issue on this website; I also am a blogger, andd Iwas wondering your situation; we have developed some nice procedures andd we are looking to trade methods with others, why not shoot me an e-mail iif interested. https://wowworkinking.com/ custom essay writing custom essay writing (Chastity) https://wowworkinking.com/

  39. Wow! After alll I got a blog from where I be capable of actually take valuable information regarding mmy study annd knowledge. https://collegepaperwritingservice603.blogspot.com/2019/08/surrealism-movements-reflectd-on.html pro essay writing service pro essay writing service https://howtowriteananalyticalessay306.blogspot.com/2019/10/final-strategic-planning-essay.html

  40. For most up-to-date information yyou have to visit world-wide-web and on weeb I found this weeb site as a finest site for hottest updates. https://writingmypaper.com write my paper affordable write my paper affordable https://writingmypaper.com

  41. When someone writes an paragraph he/she retains the image of a user in his/her brain that how a user can understad it. So that'swhy this post is outstdanding. Thanks! https://toppaperwritinghelp.com cheap cusxtom essay writing services cheap cusyom essay writing services https://toppaperwritinghelp.com

  42. constantly i used to read smaller posts which also clear their motive, and that is also happening with this article which I am reading at this place. pharmacy online https://pharmaciescegs.com/ online pharmacy

  43. Attractrive section of content. I simplly stumbled upon your weblog and in accession capital to aassert tuat I acquire in fact enjoyed account your blog posts. Anyway I will be subscribing in your feeds and even I achievement you access persistently quickly. https://essaypaperwritingservice.com buy eessay writing service buy essay writing service https://essayserviceusukua.com

  44. Cialis price cialis buy cialis online

  45. Online cialis 21cialismen.com cialis price

  46. This article is actually a fastidious one itt assists new web visitors, who are wishing for blogging. http://www.repetitor.ua/forums/thread/51364.aspx Щелкните Home

  47. Excellent forum posts. Cheers. help writing college essays how to write a thesis dissertation binding

  48. Cheap tadalafil 21cialismen.com buy viagra

  49. Thank you! Loads of stuff. https://discountedessays.com/

  50. This post offers clear idea in favor of the new users of blogging, that in fact how to do blogging and site-building. https://professionalessaywritingservice.com academic essazy writing service academic essay writing service https://professionalessaywritingservice.com

  51. I know this site provides quality based posts and additional material, is there any orher website which provides thesee kinds of infdormation in quality? https://essaysonservice.com write mme ann essay write me an essay https://essaysonservice.com

  52. We're a bunch of volounteers and starting a brand new scheme in our community. Your website offered us with valuable nfo to work on. You have done an impressjve jobb and ouur whole group will be grateful to you. https://highqualitywritingservice.com essay for me essay for me https://highqualitywritingservice.com

  53. I am not positive the place you're getting your info, howwver good topic. I needs to spend some tije learning more or working out more. Thanks for magnificent information I used tto be in search of this info foor my mission. https://orderessaycheap.com legal essay writing service legal essay writing service https://orderessaycheap.com

  54. Fantastic facts, Kudos. stanford college essays phd thesis help write my assignment for me

  55. Cheers. I like this. best non prescription online pharmacies canada online pharmacies medicine online shopping

  56. Personal loans for bad credit online https://loanus24online.com/ online loan application

  57. Online payday loans for bad credit best12loans.com popular online loans

  58. Information nicely utilized..

  59. Superb info. With thanks!

  60. Kudos, Plenty of postings. canadian prescriptions prescription drug assistance pharmacy intern

  61. 1 hour payday loans https://payday4loans.com/ direct lender payday loans

  62. Lovely postings. Thanks! best online pharmacy canada pharmaceuticals online pharmacy drugstore online

  63. Whoa plenty of valuable information! list of approved canadian pharmacies canadian mail order pharmacies

  64. Personal loans online approval loanspersonal365.com unsecured personal loans bad credit

  65. Hello everybody, here every one is sharkng these kinds of knowledge, therefore it's fastidious to read this website, aand I used to visit this blog daily. https://writemycustompaper.com essay writer essay writer https://writemycustompaper.com

  66. Personal loans online https://personal4usloans.com/ bad credit personal loans not payday loans

  67. Very energetic article, Iliked that bit. Will theree be a part 2? https://essaywritingtip134.blogspot.com/2020/10/quarterly-essay-70-dead-right.html essay uk essay uk https://howtorightanessay995.blogspot.com/2020/10/buy-essay-online-at-eight.html

  68. Many thanks, I appreciate this. how to write a proposal essay https://ouressays.com thesis writing service reviews

  69. Kudos, I like it! the best college essay ever essays writing service write thesis

  70. I know this site presents quality dependent articles or reviews and additional data, is there any other web site which offers these information in quality? https://writeessaysforme.info writing an argumentative essay writing an argumentative essay00000039 https://writeanessayforme.info/ https://writeessaysforme.info

  71. I know this site presents quality dependent articles or reviews and additional data, is there any other web site which offers these information in quality? https://writeessaysforme.info writing an argumentative essay writing an argumentative essay00000039 https://writeanessayforme.info/

  72. With thanks! I value it! how to write critical essay essays writers writing helper

  73. Superb forum posts. Kudos! canada pharmacy online no script canadian prescription drugstore online pharmacy no prescription needed

  74. You made your position very clearly!. how to write a scientific essay how to write an argumentative essay cv writing services

  75. You reported that very well.

  76. Hey just wanted to give you a quick heads up and let you know a few of thhe images aren't loading properly. I'm not sure why but I think its a linking issue. I've tried it iin ttwo different browsers and both show the same outcome. https://australianessaywritingservice.info/academic-writing-skills-books.html how too wriite a paper how to write a paper https://australianessaywritingservice.info/mechanisms-of-xname-migration-research-papers.html

  77. Free viagra https://viashoprx.com/ does viagra work

  78. Heya i'm foor the first time here. I found this board and I find It truly useful & it helped me out a lot. I hope too give something back and help others like you helped me. https://essaywritingservicereddit.info/writing-a-personal-statement-for-work.html buy essay online cheap buy essay online cheap https://essaywritingservicereddit.info

  79. After looking into a number of the blog posts on your blog, I seriously like your technique of blogging. I saved it to my bookmark sijte list aand will bee checking back in the near future. Take a look att my web site too and let me know what you think. https://buyessayonlinecheap.info/de-broglie-dissertation.html buy custom essay buy custom essay https://buyessayonlinecheap.info/strategic-analysis-case-study.html

  80. Cheers. Wonderful information.

  81. It is not my first time to visiut thnis webb page, i am browsing this site daily and take nice data from here daily. https://collegeapplicationessaywritingservice.info/ cheap research paper writing service cheapresearch paper writin service https://collegeapplicationessaywritingservice.info/writing-research-papers-the-essential-tools.html

  82. You stated that very well. highest rated canadian pharmacies online pharmacies canada

  83. Incredible all kinds of great knowledge. prescription pricing canadian pharmacy king buy online prescription drugs

  84. This is nicely put. ! essay editing services courses work dissertation on

  85. Howdy! I'm at work surfing around your blog from my new iphone! Just wanted to say I love reading your blog and look forward to all your posts! Keep up the superb work! this website this website https://bestfilm1.com https://khoibinhvietnam.com

  86. Howdy! I'm at work surfing around your blog from my new iphone! Just wanted to say I love reading your blog and look forward to all your posts! Keep up the superb work! this website this website https://bestfilm1.com

  87. Amazing lots of terrific data. pills viagra pharmacy 100mg global pharmacy canada web medical information

  88. This is nicely said! . drugs from canada with prescription online pharmacies of canada pharmacies shipping to usa

  89. Many thanks! A good amount of info! ucf college essay define dissertation marketing thesis

  90. Thanks a lot. A lot of data.

  91. Many thanks, Quite a lot of postings. urgent custom essays online coursework best article writing service

  92. Terrific write ups. Thank you. college essay sports homeworks help ghost writer essays

  93. Buy real viagra online http://hitrxmenvia.com over the counter viagra

  94. Wow loads of wonderful data. pharmacy discount best 10 online canadian pharmacies online pharmacy school

  95. Factor effectively regarded!. writing essay conclusion how to write a research papers thesis writer

  96. Terrific material. Thank you!

  97. Many thanks. Valuable information.