Easiest way to install Kubernates on your machine
Why I should learn Kubernates
- It gives same environment right from dev machine to production
- Handle different micros services together
- Open Source product from Google
- Strong community support
- Can run in multi cloud environment
- One of the hottest trends on devops industry
Kubernates Installation instructions through vagrant
Part 2: Installing &configuring kubernates dashboard
Pre-requisite:
- You should have a machine with minimum 8 GB of RAM (10 GB recommended)
- 2 GB for master
- 2 GB for node1
- 2 GB for node 2
- 2 GB for virtual box and vagrant
- 2 GB for your machine
- In my case I am running windows as host machine, You might be linux machine on which Vagrant should be up and running.
Part 1: Installation of Kubernates master and 2 nodes
- Download vagrant file from here and put it in a direcotry like Kubernates
- Go to command line and “cd Kubernates”
- Run the command “vagrant up” and wait until it gets completed
- You should have all 3 machines up and running. Just to confirm run command “vagrant global-status”. It should show all 3 machines are running. The output might be something like:-
id name provider state directory
——————————————————————————
5d7b60e k8s-master virtualbox running C:/My-Kube-Machine/Kubernates
02cb68a k8s-slave-1 virtualbox running C:/My-Kube-Machine/Kubernates
21ce8d2 k8s-slave-2 virtualbox running C:/My-Kube-Machine/Kubernates
- Run command “vagrant ssh k8s-master”
- Verify if the two command works without any error
Command1: kubectl get nodes
Command 2: kubectl get pods
If both commands are giving proper response like in below picture. You are good to go.
Part 2: Installing & configuring kubernates dashboard
- SSH into master node through vagrant ssh k8s-master
- Install kubernates-dashboard. To install run the below command:
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
- Now run the command “kubectl create serviceaccount dashboard -n default”
-
kubectl create clusterrolebinding dashboard-admin -n default --clusterrole=cluster-admin --serviceaccount=default:dashboard
- To get the credentials in order to login to you kubernates dashboard. Run the command:-
kubectl get secret $(kubectl get serviceaccount dashboard -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}" | base64 --decode
- Go to another window and ssh into master node and run the command
kubectl proxy --address 192.168.33.60 --port=9999 --accept-hosts='^*$'
- Now browse http://192.168.33.60:9999. This url is working now but its not showing dashboard yet.
- To see the dashboard open the link
- Enter the token from first window and use it for login and login it from there.
- You might see permission problem on dashboard.. if you seen then run below command on master nodes
kubectl create clusterrolebinding kubernetes-dashboard --clusterrole=cluster-admin --serviceaccount=kube-system:kubernetes-dashboard
- Best practices for micro service design - January 23, 2022
- Spring Boot - January 23, 2022
- Java - January 23, 2022
Recent Comments