[k8s]Launch a single node cluster
Overview
In this article, I launch a single node cluster using minikube.
#all contents come from
Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a VM on your laptop for users looking to try out Kubernetes or develop with it day-to-day.
You can install minikube from here
Please see this article as well
start minikube
check its version with this command
minikube version
start the cluster with this command and a Kubernetes cluster is now running in that VM.
minikube start --wait=falsee
The cluster can be interacted with using the kubectl and this is how to manage k8s and the application runnning on top of the cluster.
The details can be checked with this command
kubectl cluster-info
To see the node in the cluster
kubectl get nodes
This command shows all nodes that can be used to host our applications.
deploy containers
kubectl create deployment <deployment name> --image=<image name>
The status of the deployment can be checked
kubectl get pods
Once the container is running it can be exposed via different networking options. NodePort provides a dynamic port to a container.
kubectl expose deployment <deployment name> --port=80 --type=NodePort
The command below finds the allocated port and executes a HTTP request.
export PORT=$(kubectl get svc first-deployment -o go-template='{{range.spec.ports}}{{if .nodePort}}{{.nodePort}}{{"\n"}}{{end}}{{end}}')$ echo "Accessing host01:$PORT"
Dashboard
Enable the dashboard using Minikube with the command
minikube addons enable dashboard
kubectl apply -f <yaml config path>
Make the Kubernetes Dashboard available by deploying the following YAML definition.The Kubernetes dashboard allows you to view your applications in a UI. In this deployment, the dashboard has been made available on port 30000
You can see the dashboard like this.