Can't delete Kubernetes object: no kind "GetOptions" is registered - kubernetes

I'm getting the following error when trying to delete a StatefulSets on my local minikube cluster
error: no kind "GetOptions" is registered for version "apps/v1"
I can set the replicas to 0, but that still keeps the StatefulSet alive.
I'm running following version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Any help would be appreciated!

It seems your kubectl version and kubernetes version isn't in sync. your kubectl version doesn't know new statefulset version.
You need to upgrade your kubectl version.

Related

How to upgrade kubectl server version to v1.21

I would like to upgrade kubectl server version to be compatible with client version to get rid of Selflink issue that has been deprecated after kubernetes v1.21. How can I do this?
PS C:\> kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.7", GitCommit:"e1d093448d0ed9b9b1a48f49833ff1ee64c05ba5", GitTreeState:"clean", BuildDate:"2021-06-03T00:20:57Z", GoVersion:"go1.15.12", Compiler:"gc", Platform:"linux/amd64"}
Update your kubernetes cluster that you are using. You see the api server version there.

kubectl get deployments output differ from this in documentation

When I run this command
kubectl get deployments
at my Linux Ubuntu 18 machine, I got different output than expected (according to documentation).
Expected:
Actual:
Of course, I am not talking about values, I am talking about names of labels.
[EDIT]
My k8s version:
This is just an old output format. The newer output you're getting below contains all the same information; the "READY" field is a combination of the old "DESIRED" and "CURRENT".
It's showing as 4/5 in your output to indicate 4 pods ready/current, and 5 pods desired.
Hope this helps.
The output depends on client version. Let's check it with the same server
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
$ kubectl get deployments kube-dns -n kube-system
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
kube-dns 2 2 2 2 10d
Switching the kubectl version changes output:
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
$ kubectl get deployments kube-dns -n kube-system
NAME READY UP-TO-DATE AVAILABLE AGE
kube-dns 2/2 2 2 10d

kubernetes dashboard graphs not shown for some nodes

I have 1 master + 3 worker nodes
Kubernetes dashboard not showing graphs(Memory + CPU) for some of the PODS.
Client Version: version.Info{
Major:"1",
Minor:"12",
GitVersion:"v1.12.2",
GitCommit:"17c77c7898218073f14c8d573582e8d2313dc740",
GitTreeState:"clean",
BuildDate:"2018-10-24T06:54:59Z",
GoVersion:"go1.10.4",
Compiler:"gc",
Platform:"linux/amd64"
}
Server Version: version.Info{
Major:"1",
Minor:"12",
GitVersion:"v1.12.2",
GitCommit:"17c77c7898218073f14c8d573582e8d2313dc740",
GitTreeState:"clean",
BuildDate:"2018-10-24T06:43:59Z",
GoVersion:"go1.10.4",
Compiler:"gc",
Platform:"linux/amd64"
}
If you want to see Nodes in Kubernetes dashboard, you need go to submenu Cluster/Node as shown in screenshot in this link (not to Pods).
Kubernetes UI Nodes
For more Information please visit: https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
I hope it will be useful for you

Problem with Rabbitmq cluster in Kubernetes

I successfully setup RabbitMQ cluster by helm usig this chart (https://github.com/helm/charts/tree/master/stable/rabbitmq-ha) in k8s, but can't create connection with server in my exteranl .net core application. Receiving such exception:
RabbitMQ.Client.Exceptions.BrokerUnreachableException: "None of the specified endpoints were reachable
I have enabled ingress and have access to rmq managment console with hostname. I checked ports(5672, 15672) in docker containers, they are opened. What is wrong with this?
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:36:14Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:36:14Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}

Creating a Kubernetes job results in 'batch/, Kind=Job matches multiple kinds'

I recently upgraded from Kubernetes 1.2.0 to Kubernetes 1.3.0, and now I get the following error when I try to start a job:
$ kubectl create -f pijob.yaml
unable to recognize "pijob.yaml": batch/, Kind=Job matches multiple kinds [batch/v1, Kind=Job batch/v2alpha1, Kind=Job]
where pijob.yaml is the job definition from the tutorial:
apiVersion: batch/v1
kind: Job
metadata:
name: pi
spec:
template:
metadata:
name: pi
spec:
containers:
- name: pi
image: perl
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
restartPolicy: Never
The error is confusing because it suggests that apiVersion: batch/v1, Kind: Job should be valid. If I try apiVersion: batch/v2alpha1, Kind: Job, I also get an error:
$ kubectl create -f pijob.yaml
error validating "pijob.yaml": error validating data: couldn't find type: v2alpha1.Job
What am I doing wrong?
Have you tried with apiVersion: extensions/v1beta1?
check your kubernetes server and client version and make same one.
[root#allinone dan]# kubectl version
Client Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.0", GitCommit:"86dc49aa137175378ac7fba7751c3d3e7f18e5fc", GitTreeState:"clean", BuildDate:"2016-12-15T16:57:18Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.1", GitCommit:"82450d03cb057bab0950214ef122b67c83fb11df", GitTreeState:"clean", BuildDate:"2016-12-14T00:52:01Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
[root#allinone dan]# kubectl create -f ./job.yaml
error: unable to recognize "./job.yaml": batch/, Kind=Job matches multiple kinds [batch/v1, Kind=Job batch/v2alpha1, Kind=Job]
[root#allinone dan]# wget https://storage.googleapis.com/kubernetes-release/release/v1.5.1/bin/linux/amd64/kubectl
[root#allinone dan]# chmod +x kubectl
[root#allinone dan]# mv kubectl /usr/local/bin/kubectl
[root#allinone dan]# kubectl version
Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.1", GitCommit:"82450d03cb057bab0950214ef122b67c83fb11df", GitTreeState:"clean", BuildDate:"2016-12-14T00:57:05Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.1", GitCommit:"82450d03cb057bab0950214ef122b67c83fb11df", GitTreeState:"clean", BuildDate:"2016-12-14T00:52:01Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
[root#allinone dan]# kubectl create -f ./job.yaml
job "pi" created
I had the same error, so I followed the method below:
[root#host141 tensorflow]#wget https://storage.googleapis.com/kubernetes-release/release/v1.5.1/bin/linux/amd64/kubectl ./
[root#host141 tensorflow]# cp /usr/bin/kubectl /usr/bin/kubectl.bak
[root#host141 tensorflow]# cp kubectl /usr/bin/kubectl
[root#host141 tensorflow]# kubectl version
Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.1", GitCommit:"82450d03cb057bab0950214ef122b67c83fb11df", GitTreeState:"clean", BuildDate:"2016-12-14T00:57:05Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.0", GitCommit:"86dc49aa137175378ac7fba7751c3d3e7f18e5fc", GitTreeState:"clean", BuildDate:"2016-12-15T16:57:18Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Than I create the job and didn't have any errors left.
I had the same error message, it turned out that I was not logged in...