Helm
Helm is a package manager for Kubernetes, and “charts” are the packages they install.
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.
Install Helm as documented on their website: https://helm.sh/docs/intro/install/
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 chartREADME.md
.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
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
Forward the L7|ESP server port to your local machine:
$ kubectl port-forward --namespace <l7esp-namespace> svc/l7esp-example 8002:8002
Verify that you can access the L7|ESP server’s web UI in your browser by following this link:
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:
Deploy the Nginx ingress controller:
helm upgrade \ --atomic --install ingress-nginx ingress-nginx \ --repo https://kubernetes.github.io/ingress-nginx \ --namespace ingress-nginx \ --create-namespace
Note
For more information see the Nginx Ingress controller’s website: https://kubernetes.github.io/ingress-nginx/deploy/
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.Verify that the ingress controller is working by visiting the following URL:
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>