Args and commands for a CronJob



I have a ASP.NET Core 2.1 console application witch should run in a docker container. Width a kubernetes CronJob it should run every hour. But I don’t know what arguments (args) and commants are to set. At the internet I find lots of examples for very short console applications like “Hello world!”. Please could me help some body with informations about that.
Below you see my cronjob.yaml
Thanks for your help,

apiVersion: batch/v1beta1
kind: CronJob
name: myjob
creationTimestamp: 2019-02-15T09:10:20Z
namespace: default
selfLink: /apis/batch/v1beta1/namespaces/default/cronjobs/myjob
concurrencyPolicy: Allow
failedJobsHistoryLimit: 1
successfulJobsHistoryLimit: 3
suspend: false
schedule: “0 */1 * * *”
job: myjob
- name: ad_sync
image: busybox
command: [“printenv”]
args: [“myHost”, “80”]
restartPolicy: OnFailure


To be honest, I’m not 100% sure what you’re referring to.
If you are looking for the the difference between command and args in a podspec their equivalent with docker would be entrypoint and and command.

command in kubernetes is usually the path to the starting binary or script and args is the arguments for it.

In your example you’re passing “myHost” and “80” to printenv which would just print those environment variables.


So when my small application does not neet any arguments args stays empty
and command get’s the URL, right?

command: [“myHost”, “80”]
args: []



Command overrides the docker entrypoint, if you’re trying to pass a url or other things, those should be args.


The URL? What command do you execute to start your application? That command or some friend is the command you want.


What is the command to start?


Yo start your app? It really depends on your app.

How do you start it locally when you develop? Probably that is a good starting point


It is a console application. I start with F5.
command: [“F5”] :wink:
args: [“myHost”, “80”]

No honestly, what is the command to start a console application?


What do you use to launch it when running in a vanilla container, not in Kubernetes?


I never run vanilla container. I don’t know this container. I’m really new in this topic.


Sorry, by vanilla I meant plain (Vanilla is an english idiom for plain). Just the container itself – Outside of Kubernetes, straight docker.


No idea. I dit not start it with docker so far.
Which commands could be possible?


I would highly recommend getting to know docker and containers in general before approaching kubernetes. A good understanding of containers is an essential skill to be successful.

There are quite a few tutorial available, a few I would suggest are:


Now I will answer my question by my self for people who came along with the same question.

args stay empty, because in my console application I also dont use arguments (as usual I think)
command get the value from the endpoint at the Dockerfile
image needs to get the repository path