This guide walks you through the steps to deploy NGINX over Kubernetes in a minikube environment. Minikube is a local Kubernetes setup that requires only Docker or a Virtual Machine environment and is ideal for testing.

Use this guide as a reference for deploying any Minimus image over Kubernetes.

1

Set up minikube

If you already have a Kubernetes cluster available, you can skip ahead to the next step. If not, you can install a single node cluster using minikube to set up a testing environment. Follow the minikube get started guide to deploy a cluster, install kubectl, and test that everything is working.

The instructions are platform-specific and provided for Windows, MacOS, and Linux.

2

Fetch the example Kubernetes YAML configuration files

The configurations are based on the changes described in our general NGINX guide. To simplify the process we provide example configuration files in our GitHub repo.

Save the example yaml files to your project folder:

3

Generate the Image Pull Secret

To avoid using a Minimus token in plaintext, we will create a Kubernetes Secret containing the credentials needed to pull images from the Minimus registry.

  1. Copy a token from your console.

  2. Create a Docker auth JSON by executing the following command. Use the token from step 1 as the password when prompted:

    docker login -u minimus reg.mini.dev
    
  3. Base64 encode the auth JSON, by running:

    cat ~/.docker/config.json | base64 -w 0
    
  4. Edit the pullsecret.yaml file, to include your base64 encoded auth JSON.

    Under the data section, update the dockerconfigjson with the base64 encoded auth JSON and save your changes.

    pullsecret.yaml
    yaml pullsecret.yaml
    apiVersion: v1
    kind: Secret
    metadata:
      name: minimus-pull-secret
    data:
      .dockerconfigjson: {paste your base64 encoded auth JSON}
    type: kubernetes.io/dockerconfigjson
    
4

Deploy to your cluster

Run the following command from the project directory to deploy your NGINX container. The command applies all YAML files in the current directory (.).

kubectl apply -f .
5

Verify the pods

To check that all pods are ready and running, run:

kubectl get pods -A

You should receive a pod status check (also known as, pod readiness verification) such as hello-nginx-55bd9b99f4-bgxpd verifying the status of the pod is up and running.

If you’re new to Kubernetes, you can learn more about the ReplicaSet hash and random suffix in the official Kubernetes guide.

6

Visit the NGINX site

To look up which external IP address was set for NGINX web access, run:

minikube service hello-nginx --url

The response should print the address along with the port, for example, http://192.168.49.2:30001. Open this address in your browser to see the NGINX welcome page.

For other Kubernetes clusters, run this command to proxy access from your local machine to the service running in your cluster:

kubectl port-forward service/hello-nginx 30001:8080

Connect to http://localhost:30001 to see the NGINX welcome page. Hit CTRL-C in your terminal window to end the port forwarding.