Skip to content

Latest commit

 

History

55 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

MicroK8s: The Kubernetes Solution for Linux

Table of Contents:

1. Installation
2. Status Check
3. Turn on Services
4. Start using Kubernetes
5. Access Kubernetes Dashboard
6. Add a Worker Node
7. Pod Deployment
8. HELM Integration


1. Installation

Install MicroK8s on Linux

sudo snap install microk8s --classic

Don't have the snap command? Get snap Here


2. Check the Status while Kubernetes Initializes

sudo microk8s status --wait-ready

3. Turn on the Services you want

sudo microk8s enable dashboard
sudo microk8s enable dns
sudo microk8s enable registry
sudo microk8s enable istio

Try microk8s enable --help for a list of available services and optional features.

microk8s disable <name> turns off a service.


4. Start using Kubernetes

sudo microk8s kubectl get all --all-namespaces

5. Access the Kubernetes Dashboard

sudo microk8s dashboard-proxy

6. Add a Worker Node

Ensure that the hostname of the joining Worker Node is correctly associated with its IP address in your network's DNS or hosts file:

sudo nano /etc/hosts

Add your Worker and Control Plane Nodes to the File:

IP Address      Hostname            Description
------------------------------------------------------
127.0.0.1       localhost           Loopback Address
192.168.x.x     microk8s-master     Control Plane Node
192.168.x.x     microk8s-worker     Worker Node

Now, we can start the process of joining our worker node to the microk8s cluster:

sudo microk8s add-node

This will return some joining instructions which should be executed on the MicroK8s instance that you wish to join to the cluster (NOT THE NODE YOU RAN add-node FROM)

From the node you wish to join to this cluster, run the following:
microk8s join 192.168.1.230:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05

Use the '--worker' flag to join a node as a worker not running the control plane, eg:
microk8s join 192.168.1.230:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05 --worker

If the node you are adding is not reachable through the default interface you can use one of the following:
microk8s join 192.168.1.230:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05
microk8s join 10.23.209.1:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05
microk8s join 172.17.0.1:25000/92b2db237428470dc4fcfc4ebbd9dc81/2c0cb3284b05

Afterwards, we will run the following command to ensure that our Worker Node is now in our cluster:

sudo microk8s kubectl get nodes
or
sudo microk8s kubectl get no

7. Pod Deployment

This is a simple example of a pod deployment using a docker container


(OPTIONAL)
In order to keep a clean workspace you can do the following:

mkdir ~/Deployment && cd ~/Deployment

Next, we can create a manifest file using a .yaml extension

nano pod_name.yaml

Here is an example manifest file that you can use and modify with your own configurations:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: pod-name
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pod-name
  template:
    metadata:
      labels:
        app: pod-name
    spec:
      containers:
      - name: pod
        image: ubuntu:latest
        command: ["tail", "-f", "/dev/null"]

Now that we have our manifest file we can deploy our new pod using our Master Node:

sudo microk8s kubectl apply -f pod_name.yaml

To view your pod use the following command:

sudo microk8s kubectl get pods

For a more desciptive view of your pod use:

sudo microk8s kubectl describe pod pod_name

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors