This information will present you set up Kubernetes utilizing MicroK8s on Ubuntu. MicroK8s make it tremendous straightforward to get going with Kubernetes. Additionally, MicroK8s is bundled with instruments comparable to Prometheus. So that you allow a characteristic in the event you want it.
About MicroK8s
Canonical is the writer of MicroK8s, and you may set up it on Linux, macOS, and Home windows. As per Canonical, MicroK8s is a: low-ops, minimal manufacturing Kubernetes for devs, cloud, clusters, workstations, Edge, and IoT.
Additionally, MicroK8s:
- Helps excessive availability and does self-healing with no administrative interventions.
- It’s small, with wise defaults that simply work.
- It has the identical APIs as offered by Kubernetes.
- Has full enterprise assist obtainable with no license charges.
- Will apply safety updates routinely by default. You possibly can defer them if you’d like.
- MicroK8s runs in an immutable container, so your Kubernetes itself is totally containerized.
- It’s bundled with a complete bunch of apps that simply should be enabled. For instance, Prometheus, Jaeger, Istio, LinkerD, and KNative.
Let’s get began!
First, run the next command to put in MicroK8s on Linux:
sudo snap set up microk8s --classic
You then wish to create a gaggle for MicroK8s and add your person to the group.
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
su - $USER
You possibly can then confirm the set up standing of MicroK8s utilizing the next command:
microk8s standing --wait-ready
Subsequent, observe that MicroK8s bundles its personal model of kubectl for accessing Kubernetes. So as a substitute of utilizing “kubectl get nodes”, you’ll use “microk8s kubectl get nodes”. You possibly can repair this by including the next line to your ~/.bash_aliases file:
alias kubectl='microk8s kubectl'
MicroK8s instructions
Use the next command to get the standing:
Then, if you’d like, use this command to see the MicroK8s configuration:
Additionally, you can begin MicroK8s utilizing this command:
Then use this command to cease MicroK8s:
Lastly, you possibly can allow MicroK8s utilizing this command:
Or, you possibly can disable MicroK8s utilizing this command:
It’s also possible to take away MicroK8s if you want utilizing this command:
Kubernetes instructions
You employ the next instructions to get round your Kubernetes set up:
- Use this command to get all of the nodes within the cluster: microk8s kubectl get nodes
- This command will present all of the companies: microk8s kubectl get companies -o vast –all-namespaces
- Subsequent, you possibly can create a deployment utilizing this command: microk8s kubectl create deployment nginx –picture=nginx
- Lastly, use this command to allow options: microk8s allow dashboard dns storage
Lastly, you will get the auth token for utilizing these instructions:
token=$(microk8s kubectl -n kube-system get secret | grep default-token | lower -d " " -f1)
microk8s kubectl -n kube-system describe secret $token
Wrapping up
You’ve got now put in Kubernetes in your Ubuntu machine utilizing MicroK8s. Which instruments do you intend to allow in your recent Kubernetes set up?
You may additionally be concerned about
Sources: