Skip to main content

Helm

3797549453.png

Helm is a package manager for Kubernetes, and “charts” are the packages they install.

  1. Confirm that you are connected to the correct Kubernetes cluster:

    $ kubectl config use-context <cluster-name>
    Switched to context "l7esp-example".
    $ kubectl config current-context
    l7esp-example

    Note

    If you do not have a Kubernetes cluster yet, please do that before proceeding.

  2. Install Helm as documented on their website: https://helm.sh/docs/intro/install/

  3. Deploying the L7|ESP server to a Kubernetes cluster is performed using a Helm chart.

    $ helm dependency update ./charts/l7esp-server
    $ helm upgrade \
        --atomic \
        --create-namespace \
        --install \
        --namespace l7esp-example \
        --reset-values \
        --timeout 10m \
        --values ./values.yaml \
        l7esp-example \
        ./charts/l7esp-server

    Note

    You must provide an appropriate values.yaml file. All the configurable options are documented in the Helm chart README.md.

  4. Validate L7|ESP server was installed by getting a list of all deployed Kubernetes resources:

    $ kubectl get all --namespace <l7esp-namespace>
    NAME                                 READY   STATUS    RESTARTS   AGE
    pod/l7esp-example-56595b4b8c-gmt98   1/1     Running   0          1h
    
    NAME                    TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
    service/l7esp-example   ClusterIP   10.0.123.123   <none>        8002/TCP   1h
    
    NAME                            READY   UP-TO-DATE   AVAILABLE   AGE
    deployment.apps/l7esp-example   1/1     1            0           1h
    
    NAME                                       DESIRED   CURRENT   READY   AGE
    replicaset.apps/l7esp-example-56595b4b8c   1         1         0       1h
  5. If you want to see the logs of the L7|ESP server startup, you can do so by running:

    $ kubectl logs --follow --namespace <l7esp-namespace> pod/l7esp-example-56595b4b8c-gmt98
  6. Forward the L7|ESP server port to your local machine:

    $ kubectl port-forward --namespace <l7esp-namespace> svc/l7esp-example 8002:8002
  7. Verify that you can access the L7|ESP server’s web UI in your browser by following this link:

    localhost:8002

Setting up ingress

Ingress is a Kubernetes extension that allows you to expose services to the internet. The L7|ESP Helm chart does not install an Ingress controller, but you can install one yourself. A popular Ingress controller is the NGINX Ingress controller, which we will use in the following example:

  1. Deploy the Nginx ingress controller:

    $ helm upgrade \
        --atomic \
        --create-namespace \
        --install \
        --namespace ingress-nginx \
        --reset-values \
        --values ./values/ingress-nginx.yaml \
        --wait \
        ingress-nginx \
        ingress-nginx/ingress-nginx

    Note

    The contents of ./values/ingress-nginx.yaml are documented on the Nginx Ingress controller’s website:

    https://kubernetes.github.io/ingress-nginx/

  2. Update L7|ESP Helm chart values to apply any annotations required by the Ingress controller.

    $ helm upgrade \
        --atomic \
        --create-namespace \
        --install \
        --namespace l7esp-example \
        --reset-values \
        --values ./values.yaml \
        l7esp-example \
        ./charts/l7esp-server

    Note

    See the values.yaml file in the L7|ESP Helm chart for more information.

  3. Verify that the ingress controller is working by visiting the following URL:

    http://l7esp.example.com

Note

If you are using a different domain name, you will need to update the ingress controller to use that domain name.

Installing L7|ESP Content on kubernetes

The following steps are to install your L7|ESP environment’s project configuration and content, provided to you by the L7 Informatics implementation team.

First, scale down your deployment to one replica if you have more than one esp running using the following command (skip this step and last step if there is only one replica)

 $ kubectl scale --current-replicas=<current_number> --replicas=1 deployment/<esp deployment name>

then, get a shell into the L7|ESP pod using the following command:

 $ kubectl exec -it <pod name> -c <container-id> --namespace l7esp-example  -- bash

Next, extract the L7|ESP 3.x deployment bundle tarball and change into the directory it unpacked (where docker-compose.yml resides) before running the rest of the commands:

 $ cd /opt/l7esp/data/project
 $ wget https://$download_link
 $ tar xf $project-$version.tar.gz --strip-components=1

Next, issue the the following commands to install the configuration and content:

 $ make install

Finally, scale back to the original replica set

 $ kubectl scale --current-replicas=1 --replicas=<desire number > deployment/<esp deployment name>