Skip to content

Building Kubernetes Minikube

linuxonz edited this page Feb 8, 2024 · 28 revisions

Building Kubernetes Minikube

Kubernetes Minikube binaries are available and the instructions provided below specify the steps to install the version 1.32.0 on Linux on IBM Z.

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.

  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

    • Instructions to install Docker can be found here
      • Docker needs to be configured correctly with systemd for minikube to successfully start.
      • Information on configuring the docker systemd unit files to map to the binaries can be found here

Step 1: Install Dependencies

  • RHEL (7.8, 7.9, 8.6, 8.8, 8.9)

    sudo yum install -y wget curl git make
  • RHEL (9.0, 9.2, 9.3)

    sudo yum install -y --allowerasing wget curl git make
  • SLES (12 SP5, 15 SP5)

    sudo zypper install -y wget curl git make
  • Ubuntu (20.04, 22.04, 23.10)

    sudo apt-get update
    sudo apt-get install -y wget curl git make

Step 2: Install Minikube and Kubectl

cd $SOURCE_ROOT
export KUBERNETES_VERSION=v1.23.16
curl -LO https://github.com/kubernetes/minikube/releases/download/v1.32.0/minikube-linux-s390x && sudo install minikube-linux-s390x /usr/bin/minikube && rm -rf minikube-linux-s390x
curl -LO https://storage.googleapis.com/kubernetes-release/release/$KUBERNETES_VERSION/bin/linux/s390x/kubectl && chmod +x kubectl && sudo cp kubectl /usr/bin/ && rm -rf kubectl

Step 3: Start Minikube

sudo usermod -aG docker $USER && newgrp docker
minikube start --driver=docker --kubernetes-version=$KUBERNETES_VERSION

Note:

If minikube fails to start with the following:

Unfortunately, an error has occurred:
                timed out waiting for the condition

        This error is likely caused by:
                - The kubelet is not running
                - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)

This is due to an SELinux permission issue, which can be temporarily disabled to start minikube then re-enabled via:

sudo setenforce 0
minikube start --driver=docker --kubernetes-version=$KUBERNETES_VERSION

Note:

Above command will start a single kubernetes cluster. The cluster can be viewed using the following command:

kubectl get pods --all-namespaces

Output should look similar to this:

NAMESPACE     NAME                               READY   STATUS    RESTARTS   AGE
kube-system   coredns-bd6b6df9f-qwfmk            1/1     Running   0          12s
kube-system   etcd-minikube                      1/1     Running   0          25s
kube-system   kube-apiserver-minikube            1/1     Running   0          27s
kube-system   kube-controller-manager-minikube   1/1     Running   0          24s
kube-system   kube-proxy-9pw8f                   1/1     Running   0          12s
kube-system   kube-scheduler-minikube            1/1     Running   0          24s
kube-system   storage-provisioner                1/1     Running   0          24s

For additional insight into your cluster state, minikube bundles the Kubernetes Dashboard, allowing you to get easily acclimated to your new environment:

minikube dashboard --url=true &

If accessing the dashboard remotely, a local proxy server needs to be started:

kubectl proxy --address='0.0.0.0' --disable-filter=true &

The dashboard can then be accessed via http://<host_ip>:8001/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/.

Step 4: Sample application deployment (optional)

4.1) Install buildx tool (Only for SLES 12 SP5)

cd $SOURCE_ROOT
wget https://github.com/docker/buildx/releases/download/v0.10.2/buildx-v0.10.2.linux-s390x
mkdir -p ~/.docker/cli-plugins
cp buildx-v0.10.2.linux-s390x ~/.docker/cli-plugins/docker-buildx
chmod a+x ~/.docker/cli-plugins/docker-buildx

4.2) Build echoserver image

cd $SOURCE_ROOT
git clone --depth 1 --single-branch --branch v1.24.0 https://github.com/kubernetes/kubernetes.git
cd kubernetes/test/images/
make all WHAT=echoserver
docker tag k8s.gcr.io/e2e-test-images/echoserver:2.5-linux-s390x echoserver:2.5
minikube image load echoserver:2.5

4.3) Create a sample deployment

kubectl create deployment hello-minikube --image=echoserver:2.5
kubectl expose deployment hello-minikube --type=NodePort --port=8080

It may take a moment, but your deployment will soon show up when you run:

kubectl get services hello-minikube

4.4) LoadBalancer deployments

To access a LoadBalancer deployment, use the minikube tunnel command. Here is an example deployment:

kubectl create deployment balanced --image=echoserver:2.5
kubectl expose deployment balanced --type=LoadBalancer --port=8080

In another window, start the tunnel to create a routable IP for the ‘balanced’ deployment:

minikube tunnel

To access this service, run the following command:

kubectl get services balanced

References

Clone this wiki locally