K8S — Cluster and Context

Along the way of learning K8S, I found that sometimes I do need some reference and comparison between an original cluster and the cluster I have been testing on so to know and learn the differences.

Therefore, I come across the term Context. I knew this term for a while but never really get to know it. Link below explains it quite well.

Page from K8S showing how to manage multiple clusters.

This article is mainly to record the commends I have learned, as well as for my future reference.

In my scenario, I have two K8S cluster setup already. All commends are input from my bastion server.

Use get-contexts to list all context where the context with * is the current context, meaning that all commends are applied to that cluster. Current cluster is also shown by cluster-info and current-context commend.

Use get-clusters to list all available clusters.

Lastly, what I really want, need and helped me, set-context. Use this commend helped me change from compareset to dev cluster so I can issue kubectl commends to different clusters for comparison!

AWS Certified SA, SysOps & Developer Associate, Alibaba Cloud certified SA. Focusing on Azure, Prometheus w/ Grafana, ELK and K8S now.