Skip to content

A MicroK8s implementation of Traefik Ingress Controller with Linkerd Service Mesh

Notifications You must be signed in to change notification settings

msb1/microk8s-traefik-linkerd-whoami

Repository files navigation

microk8s-traefik-linkerd-whoami

A MicroK8s implementation of Traefik Ingress Controller with Linkerd Service Mesh in VirtualBox Guest Ubuntu VM

There is considerable confusion and lack of good documentation for the implementation of Traefik Ingress Controller with Linkerd Service Mesh within MicroK8s on a bare metal install on VirtualBox Guest Ubuntu OS. This demonstration includes metallb BGP load balancer and revisions to netplan yaml file to enable connections to the Traefik Ingress Controller from Host and connected environments (through Host-Only Network Adapter)

Notes for installation and configuration:

  1. Install MicroK8s with Snap in Ubuntu: sudo snap install microk8s --classic
  2. May need to change firewall settings: see https://microk8s.io/tutorials
  3. Edit ~/.bashrc file to include:

    • export KUBECONFIG="/var/snap/microk8s/current/credentials/client.config"
    • alias kubectl='microk8s kubectl' so that kubectl can be used with microk8s (as in minikube and k8s)

    After editing run "source .bashrc" or reboot to enable changes

  4. Set up MicroK8s with Add Ons: microk8s enable dashboard dns linkerd metallb registry storage traefik
  5. When metallb is being installed, it will be necessary to add IP addresses for load balancer. These MUST addresses that are unused by VirtualBox Host-Only Adapters but are allocated for the Host-Only Adapter (in the VirtualBox Manager, see Networks --> Properties)
  6. Install Kubernetes Services (Traefik and Whoami), then Deply and add Ingress Routes with Traefik Custom Resource Definitions
    • Traefik Custom Resource Definitions with RBAC:
      kubectl apply -f 01-traefik-crd.yaml
    • Services with Traefik Ingress as LoadBalancer:
      kubectl apply -f 02-service.yaml
    • Deployments:
      kubectl apply -f 03-deploy.yaml
    • Ingress Routes for Traefik Ingress Controller, Traefik Dashboard and Whoami:
      kubectl apply -f 04-ingress-routes.yaml
  7. Since metallb load balancer is enable, an external IP will be created for Traefik Ingress Controller - use 'kubectl get services' to show IP Address for Traefik Ingress Controller
  8. Check that pods are running and deployments are successful: 'kubectl get pods' and 'kubectl get deployments'
  9. Inject linkerd service mesh into all deployments in current (default) namespace: 'kubectl get deploy -o yaml | microk8s linkerd inject - | kubectl apply -f -'
  10. From a separate linux terminal, run Linkerd Dashboard: 'microk8s linkerd dashboard'
  11. Setup second IP address for Host-Only Network adapter enp0s3
    • For Virtualbox VM's need IP address assigned by metallb to be in VM Host-Only Virtual adapter IP range... Leave some spare IP's between highest last number and metallb IP's...
    • metallb will assign IP addresses to any LoadBalancer service - in this case Traefik Ingress Controller... edit netplan yaml file in '/etc/netplan' directory - file in this Guest VM is '01-network-manager-all.yaml'
    • use the following to add 2nd static ip for enp0s3 - this 2nd IP is Traefik Ingress Controller - loadbalancer - IP

      
      network:
        version: 2
        renderer: NetworkManager
        ethernets:
          enp0s3:
            dhcp4: false
            optional: true
            addresses: [192.168.xxx.6/24, 192.168.xxx.12/24]
          enp0s8:
            dhcp4: true
      
    • The first enp0s3 address should be the existing Host-Only adapter address (from ifconfig or ip addr) and the second address should be the address assigned by metallb to the Traefik Ingress Controller...
    • If enp0s8, a second Host-Only adapter is present, then it should be configured to allow dhcp (and NetworkManager) to determine its setup.
    • After changes to this file "sudo netplan try" or "sudo netplan apply"
  12. From VirtualBox Host (can be Windows or Linux), ping both addresses for enp0s3 adapter to ensure the config is working properly
  13. From any web browser in VirtualBox Host OS or Guest Ubuntu OS, enter "192.168.xxx.12:8080/dashboard" to see Traefik Dashboard
  14. From any web browser in VirtualBox Host OS or Guest Ubuntu OS, enter "192.168.xxx.12/whoami" to test Whoami App
This is a basic implementation that demonstrates Traefik Ingress Controller with Linkerd Service Mesh on MicroK8s running on an Ubuntu Virtual Box Guest VM. This demonstration should enable implementation of more complex applications within MicroK8s

About

A MicroK8s implementation of Traefik Ingress Controller with Linkerd Service Mesh

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published