deployment.toml for Kubernetes

You need to create a deployment-config.toml file and use it as the input to the WSO2 API Microgateway Toolkit in order to create a Docker image to be mounted on Kubernetes by including the runtime executable artifacts, so that you do not have to mount the artifacts from outside. When using this approach, it will generate the Docker images from the WSO2 API Microgateway base image by including all the API runtime artifacts as well.

Sample file

[kubernetes]
  [kubernetes.kubernetesDeployment]
    enable = true
    #name = ''
    #labels = '{"": ""}'
    #replicas = ''
    #enableLiveness = ''
    #initialDelaySeconds = ''
    #periodSeconds = ''
    #livenessPort = ''
    #imagePullPolicy = ''
    #imagePullSecrets = ['']
    #image = ''
    #env = ''
    #buildImage = ''
    #cmd = 'CMD gateway ${APP} --b7a.config.file=conf/micro-gw.conf'
    [kubernetes.kubernetesDeployment.copyFiles]
        enable = false
        [[kubernetes.kubernetesDeployment.copyFiles.files]]
            source = ''
            target = ''
    [kubernetes.kubernetesDeployment.livenessProbe]
        enable = false
        port = ''
        initialDelaySeconds = ''
        periodSeconds = ''
    [kubernetes.kubernetesDeployment.readinessProbe]
        enable = false
        port = ''
        initialDelaySeconds = ''
        periodSeconds = ''
    #dockerHost = ''
    #dockerCertPath = ''
    #push = ''
    #registry = 'index.docker.io/${DOCKER_USERNAME}'
    #username = ''
    #password = ''
    #baseImage = ''
    #singleYAML = ''
  [kubernetes.kubernetesService]
    enable = true
    #name = ''
    #labels = '{"": ""}'
    serviceType = 'NodePort'
    #port = ''
  #[kubernetes.kubernetesServiceHttps]
      #enable = false
      #name = ''
      #labels = '{"": ""}'
      #serviceType = ''
      #port = ''
  #[kubernetes.kubernetesServiceHttp]
      #enable = false
      #name = ''
      #labels = '{"": ""}'
      #serviceType = ''
      #port = ''
  #[kubernetes.kubernetesServiceToken]
      #enable = false
      #name = ''
      #labels = '{"": ""}'
      #serviceType = ''
      #port = ''
  [kubernetes.kubernetesIngress]
    enable = false
    #name = ''
    #labels = '{"", ""}'
    #hostname = ''
    #annotations = ''
    #path = ''
    #targetPath = ''
    #ingressClass = ''
  [kubernetes.secureKubernetesIngress]
    enable = false
    #name = ''
    #labels = '{"": ""}'
    #hostname = ''
    #annotations = ''
    #path = ''
    #targetPath = ''
    #ingressClass = ''
    #keyStorePath = '${ballerina.home}/bre/security/ballerinaKeystore.p12'
    #keyStorePassword = '$env{Keystore_Password}'
  [kubernetes.kubernetesHpa]
    enable = false
    #name = ''
    #labels = '{"": ""}'
    #minReplicas = ''
    #maxReplicas = ''
    #cpuPrecentage = ''
  [kubernetes.kubernetesSecret]
    enable = false
    #[[kubernetes.kubernetesSecret.secrets]]
      #name = ''
      #mountPath = ''
      #readOnly = false
      #data = ['']
  [kubernetes.kubernetesConfigMap]
    enable = true
    ballerinaConf = '<MICROGW_TOOLKIT_HOME>/resources/conf/micro-gw.conf'
    #[[kubernetes.kubernetesConfigMap.configMaps]]
      #name = ''
      #mountPath = ''
      #data = ['']
      #readOnly = false
  [kubernetes.kubernetesPersistentVolumeClaim]
    enable = false
    #name = ''
    #mountPath = ''
    #readOnly = ''
    #accessMode = ''
    #volumeClaimSize = ''

Descriptions for the configurations

kubernetes.kubernetesDeployment

Parameter Description Default value

name

Name of the deployment. <outputfilename>-deployment

namespace

Namespace of the deployment. null

labels

The labels related to the particular deployment. "app: <outputfilename>"

replicas

The number of replicas. 1

dependsOn

The endpoints that the deployment depends on. null

enableLiveness

Enable or disable the liveness probe. false

initialDelaySeconds

The initial delay in seconds before performing the first probe. 10s

periodSeconds

The time interval between liveness probes in seconds. 5s

livenessPort

The port checked by the liveness probe. <ServicePort>

imagePullPolicy

Docker image pull policy. IfNotPresent

image

Docker image with tag. <output file name>:latest

env

List of environment variables. null

buildImage

Enable or disable building the Docker image. true
copyFiles Copy external files for the Docker image. null
dockerHost Docker host IP and docker PORT.
Example:
tcp://192.168.99.100:2376
null
dockerCertPath Docker cert path. null
push Enable or disable pushing the Docker image to the registry.
This can only be enabled if buildImage parameter is set to true.
false
registry Docker registry URL null
username Username for the Docker registry. null
password Password for the Docker registry. null
baseImage Base image to create the Docker image. ballerina/ballerina:latest
imagePullSecrets Image pull secrets value. null
singleYAML Enable or disable generating a single YAML file for all k8s resources. false

kubernetes.kubernetesService

Parameter Description Default value
name Name of the service. <service name>-service
labels The labels for the service. "app: <outputfilename>"
serviceType The type of service. ClusterIP
port The port used by the service. Port number

kubernetes.kubernetesIngress

Parameter

Description

Default value

name

Name of the Ingress.

<service name>-ingress

labels

The labels for the service.

"app: <outputfilename>"

hostname

Host name of the Ingress.

<service name>.com

annotations

Map of additional annotations.

null

path

Resource path.

/

targetPath

This URL will be used to rewrite the target URI, which defines where the traffic should be redirected.


null

ingressClass

Ingress class.

nginx

enableTLS

Enable or disable Ingress transport level security (TLS).

false

kubernetes.kubernetesHPA

Parameter Description Default value
name Name of the Horizontal Pod Autoscaler <service name>-hpa
labels The labels for the service. "app: <outputfilename>"
minReplicas The minimum number of replicas in the deployment. No of replicas in deployment
maxReplicas The maximum number of replicas in the deployment. minReplicas+1
cpuPrecentage CPU percentage to start scaling. 50

kubernetes.kubernetesSecret

Parameter Description Default value
name Name of the secret mount. <service_name>-secret
mountPath Path to the mount on the container. null
readOnly Denotes whether the mount is read-only or not. true
data Paths to the data files. null

kubernetes.kubernetesConfigMap

Parameter Description Default value
name Name of the config map mount <service_name>-config-map
mountPath Path to the mount on the container null
readOnly Denotes whether the mount is read-only or not. true
ballerinaConf Location of the Ballerina conf file. null
data Paths to the data files. null

kubernetes.kubernetesPersistentVolumeClaim

Parameter Description Default value
name Name of the secret mount. null
annotations The metadata annotations in the map. null
mountPath Path to mount on the container. null
readOnly Denotes whether the mount is read-only or not. false
accessMode Access mode. ReadWriteOnce
volumeClaimSize Size of the volume claim. null
Top