Minikube

This section describes the software and configuration necessary to run Tanzu Postgres in Minikube. Using Minikube is a quick way to demonstrate Tanzu Postgres on your local system.

Required Software

To deploy Tanzu Postgres on Minikube, you will need the following software:

  • kubectl command-line utility. Install the version of kubectl that is distributed with TKGi, even if you are deploying Tanzu Postgres to Minikube. See Installing the Kuberenetes CLI in the PKS documentation for instructions.

  • Docker. Install a recent version of Docker on your machine, and start Docker.

  • Helm package manager utility, version 3.x. Follow the instructions at Kubernetes Helm to install Helm.

  • Tanzu Postgres requires the ability to map the host system’s /sys/fs/cgroup directory onto each container’s /sys/fs/cgroup. Ensure that no kernel security module (for example, AppArmor) uses a profile that disallows mounting /sys/fs/cgroup.

  • The watch command-line utility is used to monitor the process of new deployments. If necessary, use your operating system package management utility to install this utility (for example, brew install watch on MacOS platforms).

  • Minikube. See the Minikube documentation to install the latest version of Minikube. As part of the Minikube installation you must install a compatible hypervisor to your system (if one is not already available) as well as a corresponding Minikube driver for the hypervisor. For example, on MacOS systems you can use the built-in Hyperkit hypervisor by installing the Minikube Hyperkit driver.

    **Note: Do not install or re-install kubectl as part of the Minikube installation.

To validate that your system meets these prerequisites, ensure that the following commands execute without any errors, and that the output versions are similar to the ones shown:

$ kubectl version --client
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:16:51Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"darwin/amd64"}
$ docker --version
Docker version 19.03.8, build afacb8b
$ minikube version
minikube version: v1.5.2
commit: 792dbf92a1de583fcee76f8791cff12e0c9440ad
$ helm version
version.BuildInfo{Version:"v3.1.0", GitCommit:"b29d20baf09943e134c2fa5e1e1cab3bf93315fa", GitTreeState:"clean", GoVersion:"go1.13.8"}

Note: The documented procedure builds the required Docker image locally and uploads it to Minikube. As an alternative, you can use Docker support for Kubernetes.

Configuring the Minikube Cluster

Follow this procedure to start your local Minikube cluster and configure Docker for installing Tanzu Postgres:

  1. Start Docker if it is not already running on your system.

  2. Start the Minikube cluster using enough resources to ensure reasonable response times for the Postgres service. For example:

    $ minikube start --memory 4096 --cpus 4 --vm-driver=<driver-name>
    

    Substitute the name of the hypervisor driver you want to use for . For example, if you are using MacOS and you installed the Minikube Hyperkit driver, you would execute:

    minikube start --memory 4096 --cpus 4 --vm-driver=hyperkit
    

    Minikube starts the cluster and displays its progress:

    😄  minikube v1.3.1 on Darwin 10.14.6
    🔥  Creating hyperkit VM (CPUs=4, Memory=4096MB, Disk=20000MB) ...
    🐳  Preparing Kubernetes v1.15.2 on Docker 18.09.8 ...
    🚜  Pulling images ...
    🚀  Launching Kubernetes ...
    ⌛  Waiting for: apiserver proxy etcd scheduler controller dns
    🏄  Done! kubectl is now configured to use "minikube"
    
  3. Confirm that the kubectl utility can access Minikube:

    $ kubectl get node
    
    NAME       STATUS   ROLES    AGE     VERSION
    minikube   Ready    master   7m26s   v1.15.2
    

    Note: If you have problems starting or connecting to Minikube, use minikube delete to remove the current Minikube and then recreate it.

  4. Change the local docker environment to point to the Minikube docker, so that the local docker daemon interacts with images inside the Minikube docker environment:

    $ eval $(minikube docker-env)
    

    Note: To undo this docker setting in the current shell, run eval "$(docker-machine env -u)".

At this point, your system is available to install Tanzu Postgres. Follow the instructions in Installing a Postgres Operator to continue.