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
Install MicroK8s on Linux
sudo snap install microk8s --classicDon't have the snap command? Get snap Here
sudo microk8s status --wait-readysudo microk8s enable dashboard
sudo microk8s enable dns
sudo microk8s enable registry
sudo microk8s enable istioTry microk8s enable --help for a list of available services and optional features.
microk8s disable <name> turns off a service.
sudo microk8s kubectl get all --all-namespacessudo microk8s dashboard-proxyEnsure 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/hostsAdd 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 NodeNow, we can start the process of joining our worker node to the microk8s cluster:
sudo microk8s add-nodeThis 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/2c0cb3284b05Afterwards, 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 noThis 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 ~/DeploymentNext, we can create a manifest file using a .yaml extension
nano pod_name.yamlHere 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.yamlTo view your pod use the following command:
sudo microk8s kubectl get podsFor a more desciptive view of your pod use:
sudo microk8s kubectl describe pod pod_name