Skip to main content Skip to complementary content

Executing ESB artifacts on Kubernetes

Before you begin

Make sure you have a Kubernetes cluster configured and running.

Procedure

  1. Create a demorestroute.yaml configuration file as follows to deploy the DemoRESTRoute artifact.
    # Kubernetes DemoRESTRoute deployment
    						#
    						apiVersion: v1
    						kind: Service
    						metadata:
    						name: demorestroute
    						labels:
    						app : demorestroute
    						spec:
    						ports:
    						- port: <MACHINE_PORT>
    						targetPort: 8065
    						name: http-demorestroute
    						selector:
    						app : demorestroute
    						---
    						apiVersion: extensions/v1beta1
    						kind: Deployment
    						metadata:
    						name: demorestroute-v1
    						spec:
    						replicas: 1
    						template:
    						metadata:
    						labels:
    						app : demorestroute
    						version: v1
    						spec:
    						containers:
    						- name: demorestroute
    						image: <ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorestroute:latest
    						imagePullPolicy: IfNotPresent
    						ports:
    						- containerPort: 8065
    						---
    where
    • <MACHINE_PORT> corresponds to the port used to bind the host port to the container port
    • <ARTIFACT_REPOSITORY_DOCKER_REGISTRY> corresponds to the host of the URL of the artifact repository Docker registry (Nexus, Artifactory)
    • <STUDIO_PROJECT> corresponds to the Talend Studio project name that is the same as the Git project name. Project names must be in upper case.
  2. Execute the kubectl apply -f demorestroute.yaml command to deploy the artifact to Kubernetes.

    Example

    $ kubectl apply -f demorestroute.yaml
    		service/demorestroute created
    		deployment.extensions/demorestroute-v1 created
  3. Execute the kubectl get po command to check that the Kubernetes pod is up and running.

    Example

    $ kubectl get po
    NAME                                READY   STATUS    RESTARTS   AGE
    demorestroute-v1-6c4dc67648-z6zh7   1/1     Running   0          8s
  4. Access the endpoint in a browser, an XML document is returned.

    Example

    http://localhost:<MACHINE_PORT>/services/customers
  5. Execute the kubectl delete -f demorestroute.yaml command to clean the Kubernetes pod after deploying the artifact.

    Example

    $ kubectl delete -f demorestroute.yaml
    service "demorestroute" deleted
    deployment.extensions "demorestroute-v1" deleted

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!