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: 8065
          targetPort: 8065
          name: http-demorestroute
      selector:
        app: demorestroute
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: demorestroute
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: demorestroute
      template:
        metadata:
          labels:
            app: demorestroute
    #        version: v1
        spec:
          containers:
          - name: demorestroute
            image: <ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorestroute:latest
            imagePullPolicy: IfNotPresent
            args: 
              - "--name=1111"
            ports:
            - containerPort: 8065
    ---
    where
    • <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.
    • args: 
        - "--name=1111"
      corresponds to the Docker or Kubernetes context parameters that can be changed according to your deployment needs. This way of calling context parameters for Docker and Kubernetes is different from the one used for other types of context parameters (see Changing context parameters in Jobs and Routes).
  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!