Install minikube for Linux

How to install Kubernetes through minikube

One popular option for installing Kubernetes is through minikube, which creates a local Kubernetes cluster for different environments. With that environment created, you can use the Altinity Kubernetes Operator for ClickHouse® to run ClickHouse clusters. Test scripts and examples for the clickhouse-operator are based on using minikube to set up the Kubernetes environment.

The following guide demonstrates how to install minikube that support the clickhouse-operator for the following operating systems:

  • Linux (Deb based)

Minikube Installation for Deb Based Linux

The following instructions assume an installation for x86-64 based Linux that use Deb package installation. Please see the referenced documentation for instructions for other Linux distributions and platforms.

To install minikube that supports running clickhouse-operator:

kubectl Installation for Deb

The following instructions are based on Install and Set Up kubectl on Linux

  1. Download the kubectl binary:

    curl -LO 'https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl'
    
  2. Verify the SHA-256 hash:

    curl -LO "https://dl.k8s.io/v1.22.0/bin/linux/amd64/kubectl.sha256"
    
    echo "$(<kubectl.sha256) kubectl" | sha256sum --check
    
  3. Install kubectl into the /usr/local/bin directory (this assumes that your PATH includes use/local/bin):

    sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
    
  4. Verify the installation and the version:

    kubectl version
    

Install Docker for Deb

These instructions are based on Docker’s documentation Install Docker Engine on Ubuntu

  1. Install the Docker repository links.

    1. Update the apt-get repository:

      sudo apt-get update
      
  2. Install the prerequisites ca-certificates, curl, gnupg, and lsb-release:

    sudo apt-get install -y ca-certificates curl gnupg lsb-release
    
  3. Add the Docker repository keys:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --yes --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
    
    1. Add the Docker repository:

      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
      
  4. Install Docker:

    1. Update the apt-get repository:

      sudo apt-get update
      
    2. Install Docker and other libraries:

    sudo apt install docker-ce docker-ce-cli containerd.io
    
  5. Add non-root accounts to the docker group. This allows these users to run Docker commands without requiring root access.

    1. Add current user to the docker group and activate the changes to group

      sudo usermod -aG docker $USER&& newgrp docker
      

Install Minikube for Deb

The following instructions are taken from minikube start.

  1. Update the apt-get repository:

    sudo apt-get update
    
  2. Install the prerequisite conntrack:

    sudo apt install conntrack
    
  3. Download minikube:

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

    sudo install minikube-linux-amd64 /usr/local/bin/minikube
    
  5. To correct issues with the kube-proxy and the storage-provisioner, set nf_conntrack_max=524288 before starting minikube:

    sudo sysctl net/netfilter/nf_conntrack_max=524288
    
  6. Start minikube:

    minikube start && echo "ok: started minikube successfully"
    
  7. Once installation is complete, verify that the user owns the ~/.kube and ~/.minikube directories:

    sudo chown -R $USER.$USER .kube
    
    sudo chown -R $USER.$USER .minikube