IT 3300 : Virtualization

Kubernetes — Building a Cluster

Our approach

  • Build a real multi-node cluster on your Proxmox VMs
  • Options: k3s (lightweight) or MicroK8s (snap-based)
  • Both give you a genuine, clusterable Kubernetes

Option A: MicroK8s

    sudo apt update
    sudo snap install microk8s --classic
    sudo usermod -a -G microk8s $USER
    sudo chown -f -R $USER ~/.kube
    # log out and back in
    sudo snap alias microk8s.kubectl kubectl

Clustering MicroK8s

  • Install MicroK8s on each of your nodes

  • Make sure nodes can resolve each other (/etc/hosts or DNS)

  • On the first node:

      microk8s add-node
    
  • Paste the printed join command on each other node

  • Then: kubectl get nodes

Option B: k3s

  • Server (first) node:

      curl -sfL https://get.k3s.io | sh -
    
  • Get the join token from the server:

      sudo cat /var/lib/rancher/k3s/server/node-token
    
  • Agent nodes:

      curl -sfL https://get.k3s.io | \
        K3S_URL=https://<server-ip>:6443 \
        K3S_TOKEN=<token> sh -
    

kubectl — your remote control

  • kubectl talks to the API server
  • Config lives in ~/.kube/config (server address + credentials)
  • Everything you do to the cluster goes through kubectl

First commands

  • kubectl get nodes — are all nodes Ready?
  • kubectl get pods -A — every pod, all namespaces
  • kubectl cluster-info — where's the control plane?
  • kubectl describe node <name> — capacity and health

Add-ons

  • MicroK8s ships add-ons you enable as needed:

      microk8s enable dns
      microk8s enable ingress
      microk8s enable hostpath-storage
    
  • k3s bundles many defaults (Traefik ingress, local storage)

Lab goals

  • Stand up a 3-node cluster on your VMs
  • Confirm all nodes are Ready
  • Enable DNS and (later) ingress