Skip to content

Deploy CRA on Kubernetes

Badrish Chandramouli edited this page Jun 18, 2018 · 8 revisions

In order for Kubernetes to deploy CRA in a pod, the Docker image for CRA workers must have been generated and uploaded to a Docker registry before-hand, as described in the instructions here. On this page, we assume that we are working with a CRA Docker image named mydockeraccount/cra-0.1-debug on Docker Hub.

  1. Make sure you have access to a Kubernetes cluster via a ‘kubectl’ command-line tool, as described here.

  2. Open a command prompt and change directory to src\CRA.Worker

  3. Edit the deployment YAML file cra-two-instances.yml to update your Docker image name, instance name, add new instances, etc.

  4. Set the storage account name using a ConfigMap cra-config.

    kubectl create configmap cra-config --from-literal=azure_storage_conn_string=your_storage_key
    

    If you need to update this in the future, you can first delete it as follows:

    kubectl delete configmap cra-config
    

    The YAML uses this ConfigMap variable to set the environment variable AZURE_STORAGE_CONN_STRING in Docker containers, for use by the deployed CRA workers.

  5. Deploy a pod to your cluster as follows.

    kubectl create -f cra-two-instances.yml
    
  6. To see if the pod deployed successfully, you can query the Kubernetes cluster as follows:

    kubectl get pods
    

    You may also use the web browser to monitor your pods by starting a local proxy as follows:

    kubectl proxy
    

    This starts up a local web proxy that you can visit by pointing your browser to the path shown on the command line.

    You can also monitor the output of your pods by dumping the logs as follows:

    kubectl logs <your-pod-name>
    

    A full list of kubectl commands is available here.

  7. After you are done, make sure to delete your deployments (and shut down ACS).

    kubectl delete deployment crainst01 crainst02
    
Clone this wiki locally