Create Management Environment

This section will guide you through creating a fully equipped management environment by setting up rok-tools. Rok-tools is a clean Debian environment with all the tools and packages you will need preinstalled.

Choose one of the following options to create your management environment:

Option 1: Create Management Environment on Kubernetes (preferred)

This section will guide you through creating a management environment on Kubernetes. Rok-tools runs as a StatefulSet in the default namespace and uses the default storage class for the PVC, where it persists its data.

What You’ll Need

  • A Kubernetes cluster that you can access with kubectl from your machine.

Important

By applying the following YAML manifest you enable rok-tools to run with cluster-admin privileges. You will need this only if you plan to deploy Rok on the same Kubernetes cluster with rok-tools.

If you plan to deploy Rok on a different Kubernetes cluster (see Create Kubernetes Cluster) rok-tools does not require cluster admin privileges.

Procedure

  1. Deploy rok-tools in your Kubernetes cluster with kubectl. Choose one of the following options, based on your cloud provider:

    $ kubectl apply -f <download_root>/rok-tools-eks.yaml
    

    Alternatively, save the rok-tools-eks YAML manifest provided below or download rok-tools-eks.yaml and use it locally.

    Then:

    $ kubectl apply -f rok-tools-eks.yaml
    

    Note

    In case you want to use Docker inside the rok-tools environment, e.g., Mirror images to private registry, use the rok-tools-docker-eks.yaml manifest instead:

    $ kubectl apply -f <download_root>/rok-tools-docker-eks.yaml
    
    $ kubectl apply -f <download_root>/rok-tools-aks.yaml
    

    Alternatively, save the rok-tools-aks YAML manifest provided below or download rok-tools-aks.yaml and use it locally.

    Then:

    $ kubectl apply -f rok-tools-aks.yaml
    

    Note

    In case you want to use Docker inside the rok-tools environment, e.g., Mirror images to private registry, use the rok-tools-docker-aks.yaml manifest instead:

    $ kubectl apply -f <download_root>/rok-tools-docker-aks.yaml
    
  2. Verify that the rok-tools Pod is ready:

    $ kubectl get pods rok-tools-0
    NAME          READY   STATUS    RESTARTS   AGE
    rok-tools-0   1/1     Running   0          20s
    
  3. Enter the container:

    $ kubectl exec -ti statefulset/rok-tools -- /bin/bash
    

You can now proceed to the Summary section.

Option 2: Create Management Environment on Local Docker

If you don’t have access to a Kubernetes cluster, you can use Docker to start a rok-tools container locally on your machine.

Note

To ensure your data is persistent, start the rok-tools container with a volume attached to it. Moreover, map TCP port 8080 of the container to port 8080 on the Docker host, so that you can later expose Kubernetes services.

What You’ll Need

  • Docker on your machine.

Procedure

Start the rok-tools container locally with Docker:

$ mkdir rok-tools-data
$ docker run -ti \
>     --name rok-tools \
>     --hostname rok-tools \
>     -p 8080:8080 \
>     --entrypoint /bin/bash \
>     -v $(pwd)/rok-tools-data:/root \
>     -v /var/run/docker.sock:/var/run/docker.sock \
>     -w /root \
>     gcr.io/arrikto/rok-tools:release-1.2-l0-release-1.2-rc2

Verify

Ensure the latest version of rok-deploy is available:

root@rok-tools:~# rok-deploy --version
Rok rok-deploy Build ID @ROK_BUILD_ID@

Summary

You have successfully created a fully equipped management environment to deploy and manage Rok on Kubernetes using GitOps.

What’s Next

The next step is to configure Git in your management environment.