Day -3 Installation of k8s

Day -3 Installation of k8s

Minikube is an open-source tool that enables users to set up a Kubernetes cluster on their local machine. It's a great option for developers and system administrators who wish to experiment with Kubernetes without the inconvenience of creating a complete cluster..

Prerequisites

Before we begin, make sure that your Ubuntu 22.04 machine meets the following requirements:

  • A 64-bit operating system
  • 2 or more CPUs
  • At least 2GB of RAM
  • Virtualisation support enabled in BIOS
  • Internet connectivity

Installation of minikube

  • Step 1. Installing Docker

$ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

$ sudo echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

$sudo apt update

$sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

$sudo usermod -aG docker ubuntu        

  • Step 2. Updating system packages and installing Minikube dependencies

$ sudo apt update & sudo apt upgrade
$ sudo apt install -y curl wget apt-transport-https        

  • Step 3. Installing Minikube

Use the following curl command to download latest minikube binary

$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64        

Once the binary is downloaded, use the following command to install Minikube

$ sudo install minikube-linux-amd64 /usr/local/bin/minikube        

Verifying Minikube installation

$ minikube version
minikube version: v1.32.0
commit: 8220a6eb95f0a4d75f7f2d7b14cef975f050512d        

  • Step 4. Installing kubectl utility

kubectl is a command line used to interact with Kubernetes cluster. It is used for managing deployments, replica sets, services, etc. Use the following command to download the latest version of kubectl.

$ curl -LO https://storage.googleapis.com/kubernetes-release/release/"curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt"/bin/linux/amd64/kubectl        

Once kubectl is downloaded then set the executable permissions on kubectl binary and move it to the path /usr/local/bin.

$ chmod +x kubectl
$ sudo mv kubectl /usr/local/bin/        

Now, verify the kubectl version

$ kubectl version -o yaml
clientVersion:
 buildDate: "2023–11–15T16:58:22Z"
 compiler: gc
 gitCommit: bae2c62678db2b5053817bc97181fcc2e8388103
 gitTreeState: clean
 gitVersion: v1.28.4
 goVersion: go1.20.11
 major: "1"
 minor: "28"
 platform: linux/amd64
kustomizeVersion: v5.0.4–0.20230601165947–6ce0bf390ce3
serverVersion:
 buildDate: "2023–10–18T11:33:18Z"
 compiler: gc
 gitCommit: a8a1abc25cad87333840cd7d54be2efaf31a3177
 gitTreeState: clean
 gitVersion: v1.28.3
 goVersion: go1.20.10
 major: "1"
 minor: "28"
 platform: linux/amd64        

  • Step 5. Starting Minikube

As we already stated in the beginning that we would be using docker as base for Minikube. To start the minikube with the docker driver, run the following command:

$ minikube start — driver=docker        

In case Minikube cannot start because there is error regarding the Docker driver. Possible error:

$ minikube start --driver=docker
??  minikube v1.32.0 on Ubuntu 20.04 (amd64)
?  Using the docker driver based on existing profile
??  The "docker" driver should not be used with root privileges. If you wish to continue as root, use --force.
??  If you are running minikube within a VM, consider using --driver=none:
??    https://minikube.sigs.k8s.io/docs/reference/drivers/none/
??  Tip: To remove this root owned cluster, run: sudo minikube delete

?  Exiting due to DRV_AS_ROOT: The "docker" driver should not be used with root privileges.        

Use the following command to force start:

$ minikube start --driver=docker --force        

The output would be like below:

$ minikube start --driver=docker --force
??  minikube v1.32.0 on Ubuntu 20.04 (amd64)
?  minikube skips various validations when --force is supplied; this may lead to unexpected behavior
?  Using the docker driver based on existing profile
??  The "docker" driver should not be used with root privileges. If you wish to continue as root, use --force.
??  If you are running minikube within a VM, consider using --driver=none:
??    https://minikube.sigs.k8s.io/docs/reference/drivers/none/
??  Tip: To remove this root owned cluster, run: sudo minikube delete
??  Starting control plane node minikube in cluster minikube
??  Pulling base image ...
??  Restarting existing docker container for "minikube" ...
??  Preparing Kubernetes v1.28.3 on Docker 24.0.7 ...
??  Configuring bridge CNI (Container Networking Interface) ...
??  Verifying Kubernetes components...
??  Some dashboard features require the metrics-server addon. To enable all features please run:

        minikube addons enable metrics-server


??  Enabled addons: storage-provisioner, default-storageclass
??  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default        

Perfect, the above picture confirms that Minikube cluster has been confugured and started successfully.

  • Step 6. Verifying Installation

Use the following command to verify Minikube:

$ minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured        

Use the following command to verify Kubernetes:

$ kubectl cluster-info
Kubernetes control plane is running at https://192.168.49.2:8443
CoreDNS is running at https://192.168.49.2:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.        

Use the following command to test Kubernetes:

$ kubectl get nodes
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   25h   v1.28.3        


Sushan Dhewaju

Technical Support Engineer

11 个月

I'll keep this in mind

回复
Ujjwal Raj Poudel

Graduated from Kathmandu University (KU)

11 个月

Good going ??

回复

要查看或添加评论,请登录

Arjun Adhikari的更多文章

  • Day18 Understanding RBAC in Kubernetes with Practical Example

    Day18 Understanding RBAC in Kubernetes with Practical Example

    Understanding RBAC in Kubernetes with Practical Example Authentication and Authorization in Kubernetes Authentication…

    1 条评论
  • Day 17 Network Policy in Kubernetes

    Day 17 Network Policy in Kubernetes

    What is Network Policy? By default, a pod can communicate with any other pods whether it’s present in any namespaces…

    2 条评论
  • Day 16 Autoscaling

    Day 16 Autoscaling

    Kubernetes is a powerful container orchestration tool that simplifies the deployment, scaling, and management of…

  • Day 15 Resource Quotas & Limit Ranges

    Day 15 Resource Quotas & Limit Ranges

    In Kubernetes, efficient resource management is crucial for maintaining a healthy and optimized cluster environment…

  • Day14 Scheduling in Kubernetes

    Day14 Scheduling in Kubernetes

    Kubernetes is a powerful container orchestration platform that provides a way to automate the deployment, scaling, and…

  • Day13 Satefulsets

    Day13 Satefulsets

    A Statefulset is the Kubernetes controller used to run the stateful application as containers (Pods) in the Kubernetes…

  • Day12 Daemonset , Jobs & CronJobs

    Day12 Daemonset , Jobs & CronJobs

    A DaemonSet ensures that all (or some) Nodes run a copy of a Pod. As nodes are added to the cluster, Pods are added to…

  • DAY 11 Kubernetes Volume

    DAY 11 Kubernetes Volume

    Containers can be problematic for non-trivial applications due to their ephemeral nature. When a container crashes or…

  • Day 10 ConfigMap & Secret

    Day 10 ConfigMap & Secret

    How different from each other in k8s? A ConfigMap is an API object used to store non-confidential data in key-value…

    2 条评论
  • Day- 9(b) Kubernetes Ingress

    Day- 9(b) Kubernetes Ingress

    In Kubernetes, ingress is just like traffic police for the web services , it provides routes from the outside cluster…

    4 条评论

社区洞察

其他会员也浏览了