Kubernetes Cluster Setup Methods 🚀
Minikube Setup 🐳
- Minikube: Ideal for local Kubernetes cluster setup and testing.
Terraform for Kubernetes Cluster Setup
- Repository: Terraform Kubernetes Cluster (opens in a new tab)
- Description: Use Terraform to automate the setup of a Kubernetes cluster.
- Steps:
- Clone the repository:
git clone https://gitlab.com/self-made-projects/terraform-k8s-cluster.git
- Navigate to the repository directory:
cd terraform-k8s-cluster
- Initialize Terraform:
terraform init
- Apply the Terraform configuration:
terraform apply
- Follow the prompts to complete the setup.
- Clone the repository:
Kubernetes Setup using Vagrant and Kubeadm
- Vagrant: Automates VM setup for a consistent development environment.
- Steps:
- Create a
Vagrantfile
to define VM configurations. - Run
vagrant up
to create and configure the VMs. - SSH into each VM using
vagrant ssh <vm-name>
. - Install
kubeadm
,kubelet
, andkubectl
on each VM:sudo apt-get update sudo apt-get install -y kubelet kubeadm kubectl
- Initialize the Kubernetes cluster on the master node:
sudo kubeadm init
- Follow the post-installation instructions to set up
kubectl
for the non-root user and join worker nodes to the cluster.
- Create a
- Steps:
Manual Kubernetes Setup with VMs in VMware
- VMware: Use VMware to create and manage VMs for a Kubernetes cluster.
- Steps:
- Create VMs in VMware for master and worker nodes.
- SSH into each VM and install Docker:
sudo apt-get update sudo apt-get install -y docker.io
- Install
kubeadm
,kubelet
, andkubectl
:sudo apt-get install -y apt-transport-https ca-certificates curl sudo curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main" sudo apt-get update sudo apt-get install -y kubelet kubeadm kubectl
- Initialize the Kubernetes cluster on the master node:
sudo kubeadm init
- Follow the post-installation instructions to set up
kubectl
for the non-root user. - Join worker nodes to the cluster using the
kubeadm join
command provided by the master node after initialization.
- Steps:
Summary 📝
- Minikube: Quick and easy setup for local Kubernetes clusters.
- Terraform: Automates Kubernetes cluster setup, suitable for cloud environments.
- Vagrant: Consistent development environment setup using VMs.
- VMware: Manual setup providing flexibility and control over VM configurations.