Sample 2 - Deployment Parameters and Certs

Let's deploy a backend using Target Endpoint resource on your Kubernetes environment and apply API management.


  • Install a Kubernetes cluster and v1.14+ client. Alternatively, you can run Kubernetes locally via Minikube.
  • Install Docker.
  • Install the Kubernetes API Operator.
  • Setup Choreo Connect

    1. Download the Choreo Connect v0.9.0 from GitHub release page's assets and extract them to a folder of your choice. We will refer to this folder as the CHOREO-CONNECT_HOME.

    2. Using the kubectl tool, apply Kubernetes configurations for Choreo Connect.

      kubectl apply -f <CHOREO-CONNECT_HOME>/k8s-artifacts/choreo-connect
  • Install API controller Download the api controller (apictl) from the GitHub release page's assets and extract them to a folder of your choice.


Step 1: Initialize an API-CTL Project

apictl init cert-products \

Let's zip the project and create the k8s ConfigMap "cert-products-cm".

zip -r cert-products/
kubectl create cm cert-products-cm --from-file

Step 2: Create ConfigMap for Certs

openssl req -x509 -newkey rsa:4096 -nodes -days 365 \
    -subj "/ Inc./CN=cert-products" \
    -keyout products-certs.key \
    -out products-certs.crt

Create k8s ConfigMap "cert-products-certs".

kubectl create cm cert-products-certs \
    --from-file products-certs.crt

Step 3: Create Parameters ConfigMap

Let's generate the deployment directory using apictl.

apictl k8s gen deployment-dir -s cert-products/


you can also use the API-CTL project zip to create deployment-dir.

apictl k8s gen deployment-dir -s

You can see a directory created with the name DeploymentArtifacts_cert-products. Edit the DeploymentArtifacts_cert-products/params_cm.yaml file with the following content.

apiVersion: v1
kind: ConfigMap
  name: cert-products-params
  params.yaml: |
        - name: production
                    url: https://products-certs
                    url: https://products-certs
                  - hostName: products-certs
                    alias: products-certs
                    path: products-certs.crt

Apply the edited ConfigMap to the cluster.

kubectl apply -f DeploymentArtifacts_cert-products/params_cm.yaml

Step 4: Deploy API

You can see the API custom resource yaml file is generated with the directory previously created. Apply it to the cluster.

kubectl apply -f DeploymentArtifacts_cert-products/api_crd.yaml