Hostprocess pod: failed to get application name from commandline

Hello,

When I try to run a HostProcess pod I get the following

Created container win-container
  Normal   Pulled     5m10s                 kubelet, 4113k8s00000000  Successfully pulled image "acnpublic.azurecr.io/azure-cns-win:v1.4.12-43-g21f203db8-dirty" in 255.44ms
  Warning  Failed     5m5s (x4 over 6m3s)   kubelet, 4113k8s00000000  Error: failed to start containerd task "win-container": failed to get application name from commandline "/usr/local/bin/azure-cns.exe": failed to find executable "\\usr\\local\\bin\\azure-cns.exe": unknown

However, when I remove the following lines from azure-cns-windows.yaml to just make it a normal pod, and redeploy

...
      securityContext:
        windowsOptions:
          hostProcess: true
          runAsUserName: "NT AUTHORITY\\Local service"
      hostNetwork: true
     ...

It works

k logs windows-daemonset-jxp6n
Azure Container Network Service
Version v1.4.12-43-g21f203db8-dirty

Any idea on how to fix that error above for HostProcess? Could definitely be from my end

The Dockerfile and azure-cns-windows.yaml

Have the same problem, wonering about the solution.

This might be because of HostProcess’ different default content mount path. See this issue on the K8s repo.

1 Like

I found the issue, it is that when using an absolute path for the entrypoint of the container program, you need to inject the %CONTAINER_SANDBOX_MOUNT_POINT% arg in the yaml:
Windows HostProcess Pod: “failed to get application name from commandine: failed to find executable” – Coolster Codes