Skip to content

Automate and deploy Linux VMs of Kubernetes nodes

John Sundarraj edited this page Sep 10, 2024 · 1 revision

Manage Linux VMs of Kubernetes nodes using Vagrant

Windows

You can use the below commands to create, deploy, and automate Linux VMs of Kubernetes nodes on the Windows operating system using Vagrant.

  1. Open the Git Bash terminal in administrator mode.
  2. Execute the below commands in the Git Bash terminal to build, deploy, and automate Linux VMs of Kubernetes nodes.
# Switch to Kubernetes starter-kit directory.
$ cd /opt/kickstart-kubernetes

# Boot Linux VM of Kubernetes node using Vagrant.
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant up sloopstash-k8s-mtr-1
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant up sloopstash-k8s-wkr-1
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant up sloopstash-k8s-wkr-2

# Halt Linux VM of Kubernetes node using Vagrant.
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant halt sloopstash-k8s-mtr-1
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant halt sloopstash-k8s-wkr-1
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant halt sloopstash-k8s-wkr-2

# SSH to Linux VM of Kubernetes node using Vagrant.
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant ssh sloopstash-k8s-mtr-1
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant ssh sloopstash-k8s-wkr-1
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant ssh sloopstash-k8s-wkr-2

# Provision Linux VM of Kubernetes node using Vagrant.
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant provision sloopstash-k8s-mtr-1
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant provision sloopstash-k8s-wkr-1
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant provision sloopstash-k8s-wkr-2

# Destroy Linux VM of Kubernetes node using Vagrant.
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant destroy sloopstash-k8s-mtr-1
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant destroy sloopstash-k8s-wkr-1
$ VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant destroy sloopstash-k8s-wkr-2

Mac and Linux

You can use the following commands to build, deploy, and automate Linux VMs of Kubernetes nodes on a Mac or Linux operating system using Vagrant.

  1. Open the terminal.
  2. Execute the below commands in the terminal to build, deploy, and automate Linux VMs of Kubernetes nodes.
# Switch to Kubernetes starter-kit directory.
$ cd /opt/kickstart-kubernetes

# Boot Linux VM of Kubernetes node using Vagrant.
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant up sloopstash-k8s-mtr-1
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant up sloopstash-k8s-wkr-1
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant up sloopstash-k8s-wkr-2

# Halt Linux VM of Kubernetes node using Vagrant.
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant halt sloopstash-k8s-mtr-1
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant halt sloopstash-k8s-wkr-1
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant halt sloopstash-k8s-wkr-2

# SSH to Linux VM of Kubernetes node using Vagrant.
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant ssh sloopstash-k8s-mtr-1
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant ssh sloopstash-k8s-wkr-1
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant ssh sloopstash-k8s-wkr-2

# Provision Linux VM of Kubernetes node using Vagrant.
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant provision sloopstash-k8s-mtr-1
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant provision sloopstash-k8s-wkr-1
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant provision sloopstash-k8s-wkr-2

# Destroy Linux VM of Kubernetes node using Vagrant.
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant destroy sloopstash-k8s-mtr-1
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant destroy sloopstash-k8s-wkr-1
$ sudo VAGRANT_CWD=./vagrant/alma-linux-9/virtualbox/amd64/server vagrant destroy sloopstash-k8s-wkr-2