Vehicle App Deployment via PodSpecs

Learn how to prepare PodSpecs for the deployment of a Vehicle App.

This tutorial will show you how to:

  • Prepare PodSpecs
  • Deploy your Vehicle App to local K3D

Prerequisites

Use the sample PodSpecs

If the Vehicle App has been created from one of our template repositories, a sample PodSpec is already available under deploy/VehicleApp/podspec and can be used as it is without any modification. Another example can also be found in the documentation of Leda.

Content

Looking at the content of the sample-podspec, it is starting with some general information about the app and the dapr configuration. You can define e.g. the app-port and the log-level. You could also add more labels to your app, which might help to identify the app for later usages.

apiVersion: v1
kind: Pod
metadata:
  name: sampleapp
  annotations:
    dapr.io/enabled: "true"
    dapr.io/app-id: sampleapp
    dapr.io/app-port: "50008"
    dapr.io/app-protocol: grpc
    dapr.io/log-level: info
  labels:
    app: sampleapp

Afterwards the configuration of the container is specified. Please be aware that the container-port should match the app-port from the dapr-config above. In the example the app-id of the VehicleDataBroker is also specified, since the app wants to connect to it. Last but not least the image is defined which should be used for the deployment. In this example the local registry is used, which is created during the configuration of the controlplane (see here for details).

spec:
  containers:
    - name: sampleapp
      imagePullPolicy: IfNotPresent
      ports:
        - containerPort: 50008
      env:
        - name: VEHICLEDATABROKER_DAPR_APP_ID
          value: "vehicledatabroker"
      image: k3d-registry.localhost:12345/sampleapp:local

Local registry or remote registry

In the example above we used the local registry, but you can also define a remote registry in the image tag, e.g.

image: ghcr.io/eclipse-velocitas/vehicle-app-python-template/sampleapp:0.0.1-bcx

If your registry is not public, you might to add secrets to your Kubernets config, see the official documentation for details. Afterwards you have to add the secrets also to the PodSpec:

  imagePullSecrets:
  - name: regcred

Deploy your Vehicle App to local K3D

Prerequisites

  • A local K3D installation must be available. For how to setup K3D, check out this tutorial.

Deploying your app with PodSpecs can be done with one simple command:

kubectl apply -f <podspec.yaml>

In parallel you can check with K9S if the deployment is working correctly.

Next steps

Last modified January 17, 2023: Changed overview picture (#51) (ea5274b)