Followers

Kubernetes Cluster - Using Vagrant

  Installing Kubernetes Cluster (1 Master and 2 Worker Nodes) using Vagrant   (Kubeadm installation) Pod Network :- Calico Container Runtime...

 

Installing Kubernetes Cluster (1 Master and 2 Worker Nodes) using Vagrant

 (Kubeadm installation)



Pod Network:- Calico
Container Runtime: containerd

  • Step 1:- Download Virtual Box and install it on your OS
  • Step 2:- Download Vagrant and Install it (It needs to ask for restart).
  • Step 3:- Download Git and Install it.
  • Step 4:- Clone the git repo using the command
    git clone https://github.com/kmitsolution/k8s.git
  • Step 5:- Once Step 4 is executed successfully then you will get one folder k8s in the current directory
  • Under k8s there is one more folder K8s-Vagrant
  •  Change directory K8s-Vagrant/ on the command terminal
  • Step 6:- Install some vagrant plugins by running the below command
    vagrant plugin install vagrant-vbguest
  • Step 7:- Run the below command to create Kubernetes Cluster (It will take around 10-15 mins)
    vagrant up
  • If you get any error in Step 7 then you can run the command for each node seprately like
        vagrant up kmaster
        vagrant up kworker1
        vagrant up kworker2
  • Step 8:- Connect to the Master server
    vagrant ssh kmaster
      
  1.   mkdir -p $HOME/.kube
  2.   sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  3.   sudo chown $(id -u):$(id -g) $HOME/.kube/config
  • Run the below command to check all nodes are in cluster and in ready state
       kubectl get nodes
    Note:- If it shows only master node or it shows the master and worker nodes but worker nodes are not in the ready state then run below command on the master node to print the token.
      
          cat /joincluster.sh
Copy the join command and run it on worker1 and worker2
    
  • Step 9:- Verify the cluster is in ready state
    kubectl get nodes

COMMENTS

BLOGGER: 4
  1. hi raman
    how to go into the worker node
    if i do ssh kworker1 it is asking password and we dont have password

    ReplyDelete
  2. Please run these command if you want run cluster from local machine

    mkdir -p $HOME/.kube
    cp configs/config $HOME/.kube

    Please confirm Raman sir ?

    ReplyDelete
  3. mkdir -p $HOME/.kube

    sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

    sudo chown $(id -u):$(id -g) $HOME/.kube/config

    ReplyDelete
  4. root@ubuntu2004:/home/vagrant# kubectl get nodes
    The connection to the server localhost:8080 was refused - did you specify the right host or port?
    root@ubuntu2004:/home/vagrant#
    root@ubuntu2004:/home/vagrant#
    root@ubuntu2004:/home/vagrant# mkdir -p $HOME/.kube
    root@ubuntu2004:/home/vagrant# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config


    cp: cannot stat '/etc/kubernetes/admin.conf': No such file or directory

    Got above error while copying admin.conf file , kubernetes folder is not available in Master.
    Kindly help here .

    ReplyDelete

Name

Ansible,6,AWS,1,Azure DevOps,1,Containerization with docker,2,DevOps,2,Docker Quiz,1,Docker Swarm,1,DockerCompose,1,ELK,2,git,2,Jira,1,Kubernetes,1,Kubernetes Quiz,5,SAST DAST Security Testing,1,SonarQube,3,Splunk,2,vagrant kubernetes,1,YAML Basics,1,
ltr
item
DevOpsWorld: Kubernetes Cluster - Using Vagrant
Kubernetes Cluster - Using Vagrant
https://i.ytimg.com/vi/N0398oB1Dbo/hqdefault.jpg
https://i.ytimg.com/vi/N0398oB1Dbo/default.jpg
DevOpsWorld
https://www.devopsworld.co.in/2021/08/kubernetes-cluster-using-vagrant.html
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/2021/08/kubernetes-cluster-using-vagrant.html
true
5997357714110665304
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content