Home / Articles / Devops / kubernetes / 1.23.6 / kubernetes-install-minikube

Install Kubernetes on RHEL 7

Setup

PackageVersion
OSRHEL 7.6
Kubernetes1.23.6
Minikube1.25.2
Container RuntimeDocker
CPU2 core or more
RAM2GB or more
Disk Space10GB or more

Prerequisites

  • Access as root user or user having root privileges
  • Docker package installed on server

Download & Install Kubernetes

  • Login as root user or with user having root privileges
  • Download kubernetes from the official website.
  • # curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 154 100 154 0 0 641 0 --:--:-- --:--:-- --:--:-- 641 100 44.4M 100 44.4M 0 0 13.2M 0 0:00:03 0:00:03 --:--:-- 16.5M
  • Copy kubectl binary to /usr/local/bin
  • # install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
  • Check version of kubernetes
  • # kubectl version -o yaml clientVersion: buildDate: "2022-04-14T08:49:13Z" compiler: gc gitCommit: ad3338546da947756e8a88aa6822e9c11e7eac22 gitTreeState: clean gitVersion: v1.23.6 goVersion: go1.17.9 major: "1" minor: "23" platform: linux/amd64

Download & Install Minikube

    Install/Setup Minikube prerequisite

  • Install contrack package from yum repository
  • # yum -y install conntrack Loaded plugins: product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Resolving Dependencies --> Running transaction check ---> Package conntrack-tools.x86_64 0:1.4.4-4.el7 will be installed --> Processing Dependency: libnetfilter_cttimeout.so.1(LIBNETFILTER_CTTIMEOUT_1.1)(64bit) for package: conntrack-tools-1.4.4-4.el7.x86_64 --> Processing Dependency: libnetfilter_cttimeout.so.1(LIBNETFILTER_CTTIMEOUT_1.0)(64bit) for package: conntrack-tools-1.4.4-4.el7.x86_64 --> Processing Dependency: libnetfilter_cthelper.so.0(LIBNETFILTER_CTHELPER_1.0)(64bit) for package: conntrack-tools-1.4.4-4.el7.x86_64 --> Processing Dependency: libnetfilter_queue.so.1()(64bit) for package: conntrack-tools-1.4.4-4.el7.x86_64 --> Processing Dependency: libnetfilter_cttimeout.so.1()(64bit) for package: conntrack-tools-1.4.4-4.el7.x86_64 --> Processing Dependency: libnetfilter_cthelper.so.0()(64bit) for package: conntrack-tools-1.4.4-4.el7.x86_64 --> Running transaction check ---> Package libnetfilter_cthelper.x86_64 0:1.0.0-9.el7 will be installed ---> Package libnetfilter_cttimeout.x86_64 0:1.0.0-6.el7 will be installed ---> Package libnetfilter_queue.x86_64 0:1.0.2-2.el7_2 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================== Installing: conntrack-tools x86_64 1.4.4-4.el7 localrepo 186 k Installing for dependencies: libnetfilter_cthelper x86_64 1.0.0-9.el7 localrepo 18 k libnetfilter_cttimeout x86_64 1.0.0-6.el7 localrepo 18 k libnetfilter_queue x86_64 1.0.2-2.el7_2 localrepo 23 k Transaction Summary ============================================================================================================================================================== Install 1 Package (+3 Dependent packages) Total download size: 245 k Installed size: 668 k Downloading packages: (1/4): libnetfilter_cthelper-1.0.0-9.el7.x86_64.rpm | 18 kB 00:00:00 (2/4): libnetfilter_cttimeout-1.0.0-6.el7.x86_64.rpm | 18 kB 00:00:00 (3/4): libnetfilter_queue-1.0.2-2.el7_2.x86_64.rpm | 23 kB 00:00:00 (4/4): conntrack-tools-1.4.4-4.el7.x86_64.rpm | 186 kB 00:00:00 -------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 2.3 MB/s | 245 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : libnetfilter_cttimeout-1.0.0-6.el7.x86_64 1/4 Installing : libnetfilter_cthelper-1.0.0-9.el7.x86_64 2/4 Installing : libnetfilter_queue-1.0.2-2.el7_2.x86_64 3/4 Installing : conntrack-tools-1.4.4-4.el7.x86_64 4/4 Verifying : conntrack-tools-1.4.4-4.el7.x86_64 1/4 Verifying : libnetfilter_queue-1.0.2-2.el7_2.x86_64 2/4 Verifying : libnetfilter_cthelper-1.0.0-9.el7.x86_64 3/4 Verifying : libnetfilter_cttimeout-1.0.0-6.el7.x86_64 4/4 Installed: conntrack-tools.x86_64 0:1.4.4-4.el7 Dependency Installed: libnetfilter_cthelper.x86_64 0:1.0.0-9.el7 libnetfilter_cttimeout.x86_64 0:1.0.0-6.el7 libnetfilter_queue.x86_64 0:1.0.2-2.el7_2 Complete!
  • Set the kernel tuning parameter
  • # vi /etc/sysctl.conf net.bridge.bridge-nf-call-iptables = 1 # sysctl -p
  • Create a new user "kube" to run minikube and setup its group membership.
  • # useradd kube
    # usermod -aG docker kube && newgrp docker

    Download and Install Minikube.

  • Download Minikube from the official website.
  • # curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 69.2M 100 69.2M 0 0 15.0M 0 0:00:04 0:00:04 --:--:-- 16.0M
  • Copy minikube binary to /usr/local/bin
  • # install minikube-linux-amd64 /usr/local/bin/minikube
  • Switch to kube user
  • # su - kube
  • Start Minikube
  • # minikube start --driver=docker * minikube v1.25.2 on Redhat 7.6 * Using the docker driver based on user configuration X Requested memory allocation (1838MB) is less than the recommended minimum 1900MB. Deployments may fail. X The requested memory allocation of 1838MiB does not leave room for system overhead (total system memory: 1838MiB). You may face stability issues. * Suggestion: Start minikube with less memory allocated: 'minikube start --memory=1838mb' * Starting control plane node minikube in cluster minikube * Pulling base image ... * Downloading Kubernetes v1.23.3 preload ... > preloaded-images-k8s-v17-v1...: 505.68 MiB / 505.68 MiB 100.00% 14.55 Mi > gcr.io/k8s-minikube/kicbase: 379.06 MiB / 379.06 MiB 100.00% 6.05 MiB p/ * Creating docker container (CPUs=2, Memory=1838MB) ... * Preparing Kubernetes v1.23.3 on Docker 20.10.12 ... - kubelet.housekeeping-interval=5m - Generating certificates and keys ... - Booting up control plane ... - Configuring RBAC rules ... * Verifying Kubernetes components... - Using image gcr.io/k8s-minikube/storage-provisioner:v5 * Enabled addons: default-storageclass, storage-provisioner * Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
  • Check Minikube version
  • # minikube version minikube version: v1.25.2 commit: 362d5fdc0a3dbee389b3d3f1034e8023e72bd3a7
  • Check Minikube status
  • # minikube status minikube type: Control Plane host: Running kubelet: Running apiserver: Running kubeconfig: Configured
  • Check Cluster Status
  • # 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'.