PodSpecs Deployment

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

This tutorial will show you how to:

  • Prepare PodSpecs.
  • Deploy your Vehicle App to a local K3D cluster.

Prerequisites

Use the sample PodSpecs

If the Vehicle App has been created from one of our template repositories, a sample PodSpec is already available inside our maintained runtime-k3d of the devenv-runtimes package at ./runtime-k3d/src/app_deployment/config/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 containerPort should match the app-port from the Dapr configuration above. In the example the app-id of the Vehicle Data Broker 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.1.0

If the used registry requires an authentication, you can add the needed secrets to your Kubernets configuration, 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