> ## Documentation Index
> Fetch the complete documentation index at: https://docs.minimus.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy NGINX over Kubernetes

> Get started with the Minimus Nginx image in minikube

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.

<Steps>
  <Step title="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](https://minikube.sigs.k8s.io/docs/start/?arch=%2Fwindows%2Fx86-64%2Fstable%2F.exe+download) to deploy a cluster, install kubectl, and test that everything is working.

    The instructions are platform-specific and provided for Windows, MacOS, and Linux.
  </Step>

  <Step title="Fetch the example Kubernetes YAML configuration files">
    The configurations are based on the changes described in our general [NGINX guide](/guides/nginx). To simplify the process we provide example configuration files in our [GitHub repo](https://github.com/minimusio/examples/tree/main/nginx-k8s).

    Save the example yaml files to your project folder:

    * [deployment.yaml](https://github.com/minimusio/examples/blob/main/nginx-k8s/deployment.yaml)
    * [configmap.yaml](https://github.com/minimusio/examples/blob/main/nginx-k8s/configmap.yaml)
    * [service.yaml](https://github.com/minimusio/examples/blob/main/nginx-k8s/service.yaml)
    * [pullsecret.yaml](https://github.com/minimusio/examples/blob/main/nginx-k8s/pullsecret.yaml)
  </Step>

  <Step title="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](https://images.minimus.io/manage/tokens).
    2. Create a Docker auth JSON by executing the following command. Use the token from step 1 as the password when prompted:

       ```bash theme={null}
       docker login -u minimus reg.mini.dev
       ```
    3. Base64 encode the auth JSON, by running:

       ```bash theme={null}
       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.

       ```bash pullsecret.yaml theme={null}
       yaml pullsecret.yaml
       ﻿apiVersion: v1
       kind: Secret
       metadata:
         name: minimus-pull-secret
       data:
         .dockerconfigjson: {paste your base64 encoded auth JSON}
       type: kubernetes.io/dockerconfigjson
       ```
  </Step>

  <Step title="Deploy to your cluster">
    Run the following command from the project directory to deploy your NGINX container. The period at the end of the command applies all YAML files in the current directory:

    ```bash theme={null}
    kubectl apply -f .
    ```
  </Step>

  <Step title="Verify the pods">
    To check that all pods are ready and running, run:

    ```bash theme={null}
    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](https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/).
  </Step>

  <Step title="Visit the NGINX site">
    To look up which external IP address was set for NGINX web access, run:

    ```bash theme={null}
    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:

    ```bash theme={null}
    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.
  </Step>
</Steps>
