Kubernetes command arguments being ignored

2/4/2021

when running specific command from linux terminal command is the following:

/opt/front/arena/sbin/ads_start  ads  -db_server vmazfassql01 -db_name Test1

In regular docker compose yaml file we define it like this:

ENTRYPOINT ["/opt/front/arena/sbin/ads_start", "ads" ]
command: ["-db_server vwmazfassql01","-db_name Test1"]

Then I tried to convert it to Kubernetes

command: ["/opt/front/arena/sbin/ads_start","ads"]
args: ["-db_server vwmazfassql01","-db_name Test1"]

or without quotes for args

command: ["/opt/front/arena/sbin/ads_start","ads"]
args: [-db_server vwmazfassql01,-db_name Test1]

but I got errors for both cases:

Unknown parameter value '-db_server vwmazfassql01'
Unknown parameter value '-db_name Test1'

I then tried to remove dashes from args but then it seems those values are being ignored and not set up. During the Initialization values process, during the container start, those properties seem to have they default values e.g. db_name: "ads". At least that is how it is printed out in the log during the Initialization.

I tried few more possibilities: To define all of them in command:

command:
  - /opt/front/arena/sbin/ads_start
  - ads
  - db_server vwmazfassql01
  - db_name Test1

To define them in little bit different way:

command: ["/opt/front/arena/sbin/ads_start","ads"]
args:
  - db_server vwmazfassql01
  - db_name Test1


command: ["/opt/front/arena/sbin/ads_start","ads"]
args: [db_server vwmazfassql01,db_name Test1]
   

again they are being ignored, and not being set up. Am I doing something wrong? How I can make some workaround for this? Thanks

-- AndreyS
azure-aks
docker-compose
kubernetes
kubernetes-pod

1 Answer

2/4/2021

I would try separating the args, following the documentation example (https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#run-a-command-in-a-shell)

Something like:

command: ["/opt/front/arena/sbin/ads_start", "ads"]
args: ["-db_server", "vwmazfassql01", "-db_name", "Test1"]

Or maybe, it would work even like this and it looks more clean:

command: ["/opt/front/arena/sbin/ads_start"]
args: ["ads", "-db_server", "vwmazfassql01", "-db_name", "Test1"]

This follows the general approach of running an external command from code (a random example is python subprocess module) where you specify each single piece of the command that means something on its own.

-- AndD
Source: StackOverflow