This post is my personal step-by-step guide, on how to start a Kubernetes cluster on a local machine with MacOS. It does not include all the basic commands you have to execute. There are a lot of links to the official documentation instead.
Ok, let’s start.
The first thing you need to run a local K8s cluster is a tool that provides you with that cluster. I chose a very popular tool – Minikube.
Here is the “Get Started” guide for Minikube on MacOS. It contains the installation process described.
After installation we can start Minikube using the command:
If Minikube starts, we have a running K8s environment. So we can already use kubectl commands.
What is a Kubectl? A Kubectl is the Kubernetes command-line tool. It is one of the possible options to communicate with your cluster. Kubectl, as other options for cluster control, uses the Kube-APIServer to do its job.
Type in following command:
kubectl get node
If everything works, as the result, you should get one working node. We are running the K8s on a local machine using Minikube. That is why as the result we get only one node.
Now, let’s deploy the first object to our node. To do this we will need to define exactly what we need. We can do this using YAML config files.
More about Kubernetes objects and how to write the first configs you can watch, for example in this Techworld with Nana Youtube video.
At this stage, assume we have a correct config file. Then how to apply the config file? Using the command below:
kubectl apply -f mongo-config.yaml
It is always good to check if our components were deployed. To check this, type in commands like these examples provided below:
kubectl get all kubectl get configMap kubectl get secret
If we want to get more details about a specified object, we can use the kubectl describe command, as below:
kubectl describe service webapp-service
At the end of this step-by-step guide: the dashboard. Kubernetes has a web GUI that contains information about the working cluster, with all deployed services. Moreover, there is also a possibility to configure K8s cluster from this point.