Monday, 20 July 2020

kubectl and the failing versions

I was seeing the following: -

18:00:24  error: error fetching provider config: parsing time "0" as "Mon, 02 Jan 2006 15:04:05 MST": cannot parse "0" as "Mon"

from a Smoke Test running in Jenkins against a Kubernetes cluster.

In part, the Smoke Test uses kubectl to retrieve nodes, deployments and services.

Long story short, this was an issue of K8s versions.

There was a clue: -

17:59:57  Client Version: v1.18.6

17:59:57  Server Version: v1.16.2+IKS

My cluster is running K8s v1.16.2 whereas the version of kubectl is v1.18.6.

Therefore, there was a 2+ version mismatch between the two.

The problem was relatively simple ...

The Jenkins Pipeline was invoking a Bash script which was running kubectl from the path - which was picking up the default, latest version - v1.18.6 - whereas it should've been running it from the current directory ( via ./kubectl ).

Once I realised this, and remediated it, all was well .......

No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...