Cloud Malaya Lab
  • Home Cloud Lab
    • Architecture
    • DNS Server
  • DevOps & DevSecOps
    • Kubernetes
      • Fundamental
        • Taints in Kubernetes
        • Kubernetes Observability (Monitoring) Guide
        • DNS in Kubernetes (CoreDNS)
        • Storage in Kubernetes
          • Container Storage Interface - CSI
          • Ephemeral Storage Explain
        • Cluster CPU & Memory Inspections
        • Open Source and Free Storage Solution Kubernetes
      • PoC Lab
        • Configure Access to Multiple Cluster using KUBE_CONFIG
        • High Availability Portable Mini Kubernetes Data Center with K3s
          • Lab 1: Build the K3s Infrastructure
          • Lab 2: Automate the K3s clusters deployment with Ansible
          • Lab 3: Multi Master K3s kubeconfig files for smooth accessibility
          • Lab 4: Network Configurations & Tools
        • AWX/Ansible Tower Deployment on Kubernetes
          • Lab 1 - Understanding Requirements
          • Lab 2 - AWX,AWX Operator Configurations & Deployments
          • Lab 3 - Ingress Networking & Connectivity via Nginx
          • Lab 4: AWX Web Console & accessibility on LAN
        • Troubleshooting: Ansible Tower - Reset admin password
    • Monitoring & Observability
      • Splunk
        • Splunk Deployment for SME (Malay Version)
    • System Administration - Linux
      • RedHat Derivatives
        • Add User to Sudoers
        • Yum Update vs Yum Upgrade
        • DNF update vs upgrade
        • SMP PREEMPT_DYNAMIC Definitions
      • Virtualization
        • KVM
      • Storage
  • Digital Infrastructure & Cloud Solutions
    • Solution & System Design
      • Public Cloud
        • Fundamental
          • AWS
          • Azure
          • GCP
        • Lab
          • Simple CD menggunakan Github Action
      • Private Cloud & On-Premise
      • On-Premise to Cloud Design
        • AWS Direct Connect
      • High Availability & Fault Tolerance Design
      • Disaster Recovery
Powered by GitBook
On this page
  1. DevOps & DevSecOps
  2. Kubernetes
  3. PoC Lab
  4. High Availability Portable Mini Kubernetes Data Center with K3s

Lab 3: Multi Master K3s kubeconfig files for smooth accessibility

PreviousLab 2: Automate the K3s clusters deployment with AnsibleNextLab 4: Network Configurations & Tools

Last updated 1 year ago

Scenario:

We have multiple master nodes and we want to ensure that our operation using kubectl in our local machine is smooth and uninterrupted.

First, create the necessary kubeconfig files and add the configuration data into it like the following:

#My Onprem K8s master nodes
export CONFIG_K3S_MASTER_NODE01=$HOME/.kube/k3s-master-node01
export CONFIG_K3S_MASTER_NODE02=$HOME/.kube/k3s-master-node02
export CONFIG_K3S_MASTER_NODE03=$HOME/.kube/k3s-master-node03

#Merge all the configs
export KUBECONFIG=$CONFIG_K3S_MASTER_NODE01:$CONFIG_K3S_MASTER_NODE02:$CONFIG_K3S_MASTER_NODE03:$CONFIG_MINIKUBE

Finally, you may get the results just like below:

Then we modify our shell profile. Depending on your setup, as for me, I'm using as my shell. Therefore, I will modify the .zshrc file as below:

zsh
k3s-master-node0* is the file that contains the configuration data required to access the Kubernetes clusters
Notice there were multiple context displayed for my master nodes