Skip to content
Advertisement

How to pass the runtime arguments in kubectl while creating/running the pods?

I have a Spring batch application with few jobs and it is being executed as highlighted below

JavaScript

I have defined my docker file like mentioned below

JavaScript

I want to deploy/run this dockerized application on Azure Kubernetes.

I have defined my POD.YAML as mentioned below

JavaScript

How do I deploy the POD with the required cmd args – like “-jar /appl/myapp/my-bat-spr-jobs-.jar  updtTablJob” or “-cp /opt/mqm/java/lib/com.ibm.mq.allclient.jar:/appl/myapp/my-bat-spr-jobs-.jar com.demo.jobs.mappingApp  jsonToQueue”?

should I just run the image without defining the POD definition? something like below?

JavaScript

My intention is to spin up the container, execute the job based on the runtime arg & destroy the container.

Advertisement

Answer

You can pass in the running parameters through the command parameter or the args parameter (even env)

As follows:

deployment.yaml

JavaScript
  1. if use command

values.yaml

JavaScript
  1. if use args

values.yaml

JavaScript
  1. if use env

values.yaml

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement