LAB02: Get Cluster Basic & Detailed Information

LAB02 Get Cluster Basic & Detailed Information

Lab Goals

By the end of this lab, students will be able to:

  • Explore kubeconfig file & contexts

  • View Kubernetes certificates

  • Inspect static pod manifests (control plane components)

  • Find cluster name, API server endpoint

  • Connect a Kubernetes cluster to Lens

  • Retrieve essential cluster metadata using kubectl commands

** Prerequisites**

  • A running Kubernetes cluster (K8s ≥ 1.30).

  • CLI tools: kubectl, sudo access.

  • Lens installed (optional but recommended).

** PART 1: Kubeconfig & Cluster Access**

1.1 View kubeconfig file

By default kubeconfig is located at:

Check the file:

Key information inside kubeconfig:

  • clusters: name, API server URL

  • contexts: combination of cluster + user

  • users: client certs or tokens

  • current-context: default cluster your kubectl is talking to

View current context:

List contexts:

Switch context:

** PART 2: Kubernetes Certificates**

Control plane certificates are stored in:

List certificates:

Important files:

  • ca.crt → K8s root CA

  • apiserver.crt → API server certificate

  • apiserver-kubelet-client.crt

  • front-proxy-ca.crt

  • etcd/ → etcd certificates

Check certificate validity:

Check expiry:


** PART 3: Static Pods Manifest**

Static pods for control plane live in:

List static pod definitions:

You should see:

  • kube-apiserver.yaml

  • kube-controller-manager.yaml

  • kube-scheduler.yaml

  • etcd.yaml

These YAML files define how each control plane pod runs.

Example: View API Server manifest:

Look for:

  • image version

  • cert/key paths

  • service port (6443)

** PART 4: Cluster Name & API Server Endpoint**

Get cluster name:

Get API Server endpoint:

This returns:

Or from kubeconfig:

** PART 5: Configure Lens to Join the Cluster**

Steps:

  1. Open Lens

  2. Click Add Cluster

  3. Choose “Add from kubeconfig

  4. Lens auto-detects ~/.kube/config

  5. Select cluster and press Add

  6. Cluster appears on the left panel

  7. Click to open and it will prompt for access

  8. Cluster Dashboard opens with:

    • Nodes pane

    • Workloads

    • Storage

    • Events

    • Metrics

If your kubeconfig is not in default location:

  • Click Browse and upload/custom select the file.

** PART 6: Useful Cluster Metadata Commands**

Get nodes:

Get API server version:

Get cluster info:

View component statuses (if enabled):

Get namespaces:

Get all pods in all namespaces:

** PART 7: Inspecting Control Plane Pods**

Run these on the master node inside kubelet:

Check control plane pods:

Expected:

  • kube-apiserver

  • kube-controller-manager

  • kube-scheduler

  • etcd

  • coredns

  • network plugin (calico/flannel etc.)

** PART 8: Bonus — Explore API Server Logs**

Get logs:

For example:

Last updated