It was written if I read the document properly. However, it seems easy to make a mistake, so make a note.
――What to read properly - https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/ - https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#notes
--The command in the manifest is the ENTRY POINT in the Dockerfile. --Manifest args is CMD in Dockerfile
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
  - name: command-demo-container
    image: debian
    command: ["printenv"]                    #This is ENTRY POINT
    args: ["HOSTNAME", "KUBERNETES_PORT"]    #This is CMD
  restartPolicy: OnFailure
Also note that the behavior changes depending on whether command and args are defined respectively.
Dockerfile
If
| command | args | Command to be executed | 
|---|---|---|
| undefined | undefined | echo HOSTNAME | 
| printenv | undefined | printenv | 
| undefined | KUBERNETES_PORT | echo KUBERNETES_PORT | 
| printenv | KUBERNETES_PORT | printenv KUBERNETES_PORT | 
Will be.
Recommended Posts