2022年3月25日 星期五

How to trigger a kubenetes schedule job manually

kubectl create job --from=cronjob/[cronjob name] [new job] -n [namespace]
sometimes you may encounter the error such as
"error: unknown object type *v1beta1.CronJob"
it was caused by the kubectl is different version. you can download the old one to resolve issue

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5", GitCommit:"c285e781331a3785a7f436042c65c5641ce8a9e9", GitTreeState:"clean", BuildDate:"2022-03-16T15:58:47Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.15", GitCommit:"0f9140665765825f8a4187cefd055e4b350b4a36", GitTreeState:"clean", BuildDate:"2021-09-17T23:04:02Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.23) and server (1.19) exceeds the supported minor version skew of +/-1

for me, my kubectl client is v1.23.5, but server is older version wiht v1.19.15, therefor I downgraded to the older one to resolve the issue
curl -LO https://dl.k8s.io/release/v1.19.15/bin/linux/amd64/kubectl

沒有留言:

How to restore a deleted onenote page

復原不小心誤刪的onenote