Deploying a Task Application in Kubernetes

This guide walks through how to deploy and run a simple spring-cloud-task application on Kubernetes by using Spring Cloud Data Flow.

We deploy the sample billsetuptask application to Kubernetes.

Setting up SCDF the Kubernetes Cluster

For this guide, we need a running Kubernetes cluster with Spring Cloud Data Flow deployed. For this example, we use minikube.

Verifying that Spring Cloud Data Flow is Running

When SCDF is running on Kubernetes, you should see the scdf-server pod in a Running state and the associated service created. You can use the following command (shown with typical output) to see the scdf-server:

$ kubectl get all -l app=scdf-server
NAME                              READY   STATUS    RESTARTS   AGE
pod/scdf-server-65789665d-79hrz   1/1     Running   0          5m39s

NAME                  TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
service/scdf-server   LoadBalancer   10.109.181.91   <pending>     80:30403/TCP   5m39s

NAME                          READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/scdf-server   1/1     1            1           5m39s

NAME                                    DESIRED   CURRENT   READY   AGE
replicaset.apps/scdf-server-65789665d   1         1         1       5m39s

NOTE: On Minikube, EXTRNAL-IP = <pending> for the service is normal.

Building a Docker Image for the Sample Task Application

We build the billsetuptask app, which is configured with the jib maven plugin. To do so:

  1. Clone or download the task samples git repo and navigate to the billsetuptask directory.
  2. Run the following commands to build the docker image:

    $ eval $(minikube docker-env)
    $ ./mvnw clean package jib:dockerBuild

    Those commands add the image to the minikube Docker registry.

  3. Verify its presence by finding springcloudtask/billsetuptask in the list of images provided by running the following command:

    $ docker images

Registering, Creating, and Launching the Task by Using Data Flow

We use the Data Flow Dashboard to set up and launch the billsetuptask application.

First, we need to get the SCDF Server URL, which we can do with the following command (the listing includes the output):

$ minikube service --url scdf-server
http://192.168.99.100:30403

Now you can follow the instructions to register and launch a task application using Data Flow, using the docker image we just built to register the application.