istvano / ansible_role_microk8s

Ansible role to install microk8s on ubuntu
MIT License
104 stars 73 forks source link

Enabling `microk8s_enable_HA: true` dosn't add nodes to master #42

Closed mosgjig closed 1 year ago

mosgjig commented 1 year ago

Attempting to create a cluster with 3 raspberry Pi's.

The playbook to run the role:

---
- hosts: cluster
  gather_subset:
    - all_ipv4_addresses

- hosts: cluster
  # serial: 1
  gather_facts: yes
  roles:
    - role: istvano.microk8s
      become: true
      vars:
        users:
          - ubuntu
        microk8s_version: stable
        microk8s_enable_HA: true
        microk8s_group_HA: cluster

Logs don't indicate any issues when adding nodes to master. Performing a check on master doesn't show HA:

$ ansible cluster -i inventories/microk8s/hosts -m shell -a "microk8s status" --limit pimaster
pi | CHANGED | rc=0 >>
microk8s is running
high-availability: no
  datastore master nodes: 192.168.1.226:19001
  datastore standby nodes: none
addons:
  enabled:
    dashboard            # (core) The Kubernetes dashboard
    dns                  # (core) CoreDNS
    ha-cluster           # (core) Configure high availability on the current node
    helm                 # (core) Helm - the package manager for Kubernetes
    helm3                # (core) Helm 3 - the package manager for Kubernetes
    host-access          # (core) Allow Pods connecting to Host services smoothly
    hostpath-storage     # (core) Storage class; allocates storage from host directory
    ingress              # (core) Ingress controller for external access
    metrics-server       # (core) K8s Metrics Server for API access to service metrics
    rbac                 # (core) Role-Based Access Control for authorisation
    registry             # (core) Private image registry exposed on localhost:32000
    storage              # (core) Alias to hostpath-storage add-on, deprecated
  disabled:
    cert-manager         # (core) Cloud native certificate management
    community            # (core) The community addons repository
    kube-ovn             # (core) An advanced network fabric for Kubernetes
    mayastor             # (core) OpenEBS MayaStor
    metallb              # (core) Loadbalancer for your Kubernetes cluster
    minio                # (core) MinIO object storage
    observability        # (core) A lightweight observability stack for logs, traces and metrics
    prometheus           # (core) Prometheus operator for monitoring and logging

Ran the role multiple times to no avail... output from last run:

TASK [istvano.microk8s : configure High Availability] ***********************************************************************************************************************************
included: /home/<redacted>/roles/istvano.microk8s/tasks/configure-HA.yml for pi, pi-1, pi-2

TASK [istvano.microk8s : Enumerate all cluster HA hosts within the hosts file] **********************************************************************************************************
ok: [pi-2]
ok: [pi-1]
ok: [pi]

TASK [istvano.microk8s : Enumerate all cluster worker hosts within the hosts file] ******************************************************************************************************
skipping: [pi]
skipping: [pi-1]
skipping: [pi-2]

TASK [istvano.microk8s : Find the designated host] **************************************************************************************************************************************
ok: [pi]
ok: [pi-1]
ok: [pi-2]

TASK [istvano.microk8s : Waiting for microk8s to be ready on microk8s host master] ******************************************************************************************************
skipping: [pi]
ok: [pi-1 -> pi(192.168.1.226)]
ok: [pi-2 -> pi(192.168.1.226)]

TASK [istvano.microk8s : Get the microk8s join command from the microk8s master] ********************************************************************************************************
skipping: [pi]
ok: [pi-1 -> pi(192.168.1.226)]
ok: [pi-2 -> pi(192.168.1.226)]

TASK [istvano.microk8s : Get microk8s cluster nodes] ************************************************************************************************************************************
skipping: [pi]
ok: [pi-1 -> pi(192.168.1.226)]
ok: [pi-2 -> pi(192.168.1.226)]

TASK [istvano.microk8s : Waiting for microk8s to be ready on microk8s host node] ********************************************************************************************************
skipping: [pi]
ok: [pi-1]
ok: [pi-2]

TASK [istvano.microk8s : Set the microk8s join command on the microk8s node] ************************************************************************************************************
skipping: [pi]
skipping: [pi-1]
skipping: [pi-2]

Anything missing?

mosgjig commented 1 year ago

Closing issue... went in and purged microk8s from each server and re-ran the role with result:

ansible cluster -i inventories/microk8s/hosts -m shell -a "microk8s status" --limit pimaster
pi | CHANGED | rc=0 >>
microk8s is running
high-availability: yes
  datastore master nodes: 192.168.1.226:19001 192.168.1.227:19001 192.168.1.229:19001
  datastore standby nodes: none
addons:
  enabled:
    dashboard            # (core) The Kubernetes dashboard
    dns                  # (core) CoreDNS
    ha-cluster           # (core) Configure high availability on the current node
    helm                 # (core) Helm - the package manager for Kubernetes
    helm3                # (core) Helm 3 - the package manager for Kubernetes
    host-access          # (core) Allow Pods connecting to Host services smoothly
    hostpath-storage     # (core) Storage class; allocates storage from host directory
    ingress              # (core) Ingress controller for external access
    metrics-server       # (core) K8s Metrics Server for API access to service metrics
    rbac                 # (core) Role-Based Access Control for authorisation
    registry             # (core) Private image registry exposed on localhost:32000
    storage              # (core) Alias to hostpath-storage add-on, deprecated
  disabled:
    cert-manager         # (core) Cloud native certificate management
    community            # (core) The community addons repository
    kube-ovn             # (core) An advanced network fabric for Kubernetes
    mayastor             # (core) OpenEBS MayaStor
    metallb              # (core) Loadbalancer for your Kubernetes cluster
    minio                # (core) MinIO object storage
    observability        # (core) A lightweight observability stack for logs, traces and metrics
    prometheus           # (core) Prometheus operator for monitoring and logging