"kubectl apply -o json" returned invalid JSON"


We are trying to configure a ‘DEPLOY RAW KUBERNETES YAML’ . The step fails with error:

“kubectl apply -o json” returned invalid JSON:
This can happen with older versions of kubectl. Please update to a recent version of kubectl.

Full log file attached. step.log (13.7 KB)

Running the command manually in powershell works without a problem.

Any help would be appreciated.

Hi @helmiensteyn,

First of all welcome to the Octopus Forums!

Thanks for reaching out.

The first thing that comes to mind here is the kubectl version that the Octopus tentacle sees/has access to might be different than the one you’re using when you manually run it in powershell.

Can you run kubectl version --client in a dummy step on the target, as well as in the powershell where the command works and see if there is any difference?

Please let me know how it goes.



Thank you for the reply.

The versions seem to be in line:

Powershell output:
Client Version: version.Info{Major:“1”, Minor:“18”, GitVersion:“v1.18.0”, GitCommit:“9e991415386e4cf155a24b1da15becaa390
438d8”, GitTreeState:“clean”, BuildDate:“2020-03-25T14:58:59Z”, GoVersion:“go1.13.8”, Compiler:“gc”, Platform:“windows/a
Server Version: version.Info{Major:“1”, Minor:“18”, GitVersion:“v1.18.3”, GitCommit:“2e7996e3e2712684bc73f0dec0200d64eec
7fe40”, GitTreeState:“clean”, BuildDate:“2020-05-20T12:43:34Z”, GoVersion:“go1.13.9”, Compiler:“gc”, Platform:“linux/amd

Output from the dummy step in Octopus:
Client Version: version.Info{Major:“1”, Minor:“18”, GitVersion:“v1.18.0”, GitCommit:“9e991415386e4cf155a24b1da15becaa390438d8”, GitTreeState:“clean”, BuildDate:“2020-03-25T14:58:59Z”, GoVersion:“go1.13.8”, Compiler:“gc”, Platform:“windows/amd64”}

If we use a ‘RUN A KUBECTL CLI SCRIPT’ step instead and embed the yml in the script, as suggested here, it deploys without a problem.


Hi @helmiensteyn,

Thanks for the information.

Would you be able to privately message me the YAML and the Deployment process json so I can try to reproduce on my end?

To get the JSON, go to the Project, then the process section, then click the 3 dots to the right of add step and click download JSON.

Please let me know if that works for you.


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.