Deployment

All Kaa services, including CEX, are distributed as Helm charts. You can run these charts using Kubernetes.

Installing CEX chart on Kubernetes

Preparation

These steps should be done once for your entire Kaa cluster in Kubernetes.

  1. Install Kubernetes.

  2. Install Helm client and Tiller server.

  3. Create a Kaa license secret (remember to put in your Kaa license key file contents and password):

     export HISTCONTROL=ignorespace # Prevent saving your key password in the shell history; note the leading space in the next line
      cat << EOF > /tmp/kaa-licence.yaml
     apiVersion: v1
     data:
       file: < your licence key file contents, base64-encoded >
       password: < your licence key password >
     kind: Secret
     metadata:
       name: license
       type: Opaque
     EOF
     kubectl create -f /tmp/kaa-licence.yaml
    
  4. Specify the image pull secret for the official KaaIoT docker registry. To define this secret, use your KaaID credentials:

     export HISTCONTROL=ignorespace  # Prevent saving your credentials in the shell history; note the leading space in the next line
      export KAAID_EMAIL=<your KaaID email, eg. bob@example.com> KAAID_PASSWORD=<your KaaID password>
     kubectl create secret docker-registry kaaid --docker-server=dev-hub.kaaiot.net --docker-username=$KAAID_EMAIL --docker-email=$KAAID_EMAIL --docker-password=$KAAID_PASSWORD
    
  5. If you want to enable API security in your Kaa cluster (recommended), you should create an auth server backend secret for the service to be able to request PAT tokens.

     export HISTCONTROL=ignorespace # Prevent saving your client ID amd secret in the shell history; note the leading space in the next line
      cat << EOF > /tmp/keycloak-backend-secret.yaml
     apiVersion: v1
     data:
       client-id: < your client-id, base64-encoded >
       client-secret: < your client-secret, base64-encoded >
     kind: Secret
     metadata:
       name: "keycloak-backend"
       labels:
         app.kubernetes.io/name: "kaa-name"
         helm.sh/chart: "kaa-chart-version"
         app.kubernetes.io/instance: "kaa-instance-name"
         app.kubernetes.io/managed-by: "release-service-name"
     EOF
     kubectl create -f /tmp/keycloak-backend-secret.yaml
    
  6. Add the KaaIoT Helm repository:

     helm repo add kaa-museum https://museum.kaaiot.net/
    

Installation

Once you have completed the preparation steps, everything is ready for deploying CEX on your Kubernetes cluster. To deploy the service, run the following command (observe the reference to the previously created license secret):

helm install --set global.license.secretName=license kaa-museum/cex --name kaa-cex

Check that pods are running:

kubectl get pods

Once the service initialization is complete, you should observe the output similar to the below:

NAME                                          READY   STATUS             RESTARTS   AGE
...
kaa-cex                                       1/1     Running            0          2m
...

Chart Requirements

Repository Name Version
@stable nats 2.0.6
@stable postgres 12.1

Chart Values

Key Type Default Description
affinity object {}  
annotations.deployment object {}  
annotations.pod object {}  
config string "" Content for the service config map, automatically mounted as a config file into the pod.
env object {"JAVA_OPTS":{"value":"-XX:MaxRAMPercentage=80.0 -XX:MinRAMPercentage=50.0 -Xverify:none -XX:TieredStopAtLevel=1"}} Defines the environment variables that Kubernetes passes to the service replica.
extraPodSpecs.automountServiceAccountToken bool false  
fullnameOverride string ""  
global.image.pullSecrets list [] List of image pull secret names. Each must be defined as a record with the name field. Overrides image.pullSecrets.
global.keycloak.backendSecretName string "" Name of the backend auth server secret, which must contain base64-encoded client-id and client-secret. Required.
global.keycloak.baseUrl string "" Auth provider base URL. Required.
global.keycloak.enabled string "" Enables API security using the auth provider. Overrides keycloak.enabled.
global.keycloak.realm string "" Auth provider realm. Required.
global.license.secretName string "" Name of the license secret, which must contain two base64-encoded fields: file (license file contents in PKCS #12) and password. Overrides license.secretName.
global.nats.url string "" NATS URL. Overrides nats.url.
global.postgres.url string "" Postgres database URL.
global.tekton.enabled string "" Enables Tekton integration. When disabled, the service will expect Kaa application configs to be defined in the config map. Overrides tekton.enabled.
global.tekton.url string "" Tekton URL. Overrides tekton.url.
image.pullPolicy string "IfNotPresent" Docker image pull policy.
image.pullSecrets list [] List of image pull secret names. Each must be defined as a record with the name field.
image.repository string "dev-hub.kaaiot.net/core/service/cex/cex" Docker image repository image URL.
image.tag string "" Docker image tag version to pull and run.
ingress.annotations object {} You can use annotations to attach metadata to Kubernetes objects.
ingress.enabled bool false  
ingress.hosts list ["chart-example.local"] hosts must match the content of an incoming request before the load balancer directs traffic to the referenced Service.
ingress.paths list [] paths must match the content of an incoming request before the load balancer directs traffic to the referenced Service.
ingress.tls list [] Utilize TLS backend in ingress
keycloak.enabled string "" Enables API security using the auth provider. Overrides global.keycloak.enabled.
license.secretName string "" Name of the license secret, which must contain two base64-encoded fields: file (license file contents in PKCS #12) and password.
metadata.component string "backend"  
metadata.partOf string "kaa"  
nameOverride string ""  
nats.auth.enabled bool false  
nats.enabled bool true For detailed info please look in https://github.com/helm/charts/tree/master/stable/nats
nats.url string "nats://-nats-client:4222" NATS url
nats.urlOverride string ""  
nodeSelector object {}  
probes.enabled bool true Enables liveness, readiness, and startup probes for containers.
probes.liveness.initialDelaySeconds int 300  
probes.liveness.periodSeconds int 3  
probes.readiness.initialDelaySeconds int 10  
probes.readiness.periodSeconds int 5  
postgres.cluster.enabled bool false  
postgres.enabled bool true https://github.com/helm/charts/tree/master/stable/postgresql
postgres.master.persistence.enabled bool false  
postgres.url string "--master" Postgres URL.
postgres.urlOverride string ""  
postgres.usePassword bool false Enable password for Postgres.
replicaCount int 1 The number of service instance replicas to run.
resources.limits.cpu int 2  
resources.limits.memory string "700Mi"  
resources.requests.cpu string "200m"  
resources.requests.memory string "700Mi"  
securityContext object {}  
service.externalIPs list []  
service.loadBalancerIP string ""  
service.port int 80 Port of running EPR
service.type string "ClusterIP" Kubernetes Service type
tekton.enabled bool false Enables Tekton integration. When disabled, the service will expect Kaa application configs to be defined in config.
tekton.url string "http://-tekton" Tekton URL.
tekton.urlOverride string "" Tekton URL. Overrides global.tekton.url and tekton.url.
terminationMessagePolicy string "FallbackToLogsOnError" Kubernetes termination message policy.
tolerations list []  
updateStrategy.type string "RollingUpdate" Deployment update strategy.
waitContainers.curl.image string "dev-hub.kaaiot.net/devops/docker/alpine-curl-jq/alpine-curl-jq"  
waitContainers.curl.tag string "0.0.2"  
waitContainers.enabled bool true Waiting for dependent on services.
waitContainers.timeout int 300 Waiting for dependent on services in seconds.

The keys with no description are standard Kubernetes values. Refer to the official Kubernetes documentation for more information on these.

Environment variables

The table below summarizes the variables supported by the CEX Docker image and provides default values along with descriptions.

Variable name Default value Description
INSTANCE_NAME cex Service instance name.
APP_CONFIG_PATH /srv/cex/service-config.yml Path to the service configuration YAML file inside container. In case of running in Kubernetes, consider using K8s Volumes for externalization.
KAA_TEKTON_ENABLED false Enables Tekton integration.
KAA_TEKTON_URL http://tekton URL of the Tekton service.
KAA_SECURITY_ENABLED false Enables authentication and authorization on REST API endpoints (inbound and outbound API calls).
KAA_SECURITY_ISSUER   OAuth 2.0 issuer URL for the system tenant (“kaa”).
KAA_SECURITY_CLIENT_ID   Client ID for making requests in the system tenant scope.
KAA_SECURITY_CLIENT_SECRET   Client secret for making requests in the system tenant scope.
KAA_SECURITY_MULTITENANCY_ENABLED false Enables multitenancy via integration with the Kaa Tenant Manager. Only effective when kaa.security.enabled is set to true.
KAA_SECURITY_MULTITENANCY_TENANT_MANAGER_URL "http://tenant-manager" URL of the Kaa Tenant Manager that provides security configurations for tenants.
JMX_ENABLE false Enables JMX monitoring.
JMX_PORT 10500 JMX service port.
JMX_MONITOR_USER_PASSWORD   JMX monitor user password. Required when JMX_ENABLE=true.
JAVA_OPTIONS -Xmx700m Additional parameters for Java process launch.
NATS_USERNAME   Username for connecting to NATS message broker.
NATS_PASSWORD   Password for connecting to NATS message broker.
KAA_LICENSE_CERT_PATH /run/license/license.p12 Path to the Kaa platform license certificate file in PKCS #12 format.
KAA_LICENSE_CERT_PASSWORD   License certificate password. Required.