debugkubernetesMinor
How do I get Kubernetes to work when I get an error "the server could not find the requested resource"?
Viewed 0 times
finderrorthehowresourcekubernetescouldgetworkwhen
Problem
I cannot create a kubernetes pod. I just deployed Kubernetes to Ubuntu 16.04.
I have this as a.yml:
I run this:
I get this:
Error from server (NotFound): the server could not find the requested
resource
I expected the above command to create a pod.
I ran this:
I got this:
```
{
"selfLink": "/api/v1/nodes",
"resourceVersion": "185",
"Items": [
{
"name": "ip-10-10-10-10",
"selfLink": "/api/v1/nodes/ip-10-10-10-10",
"uid": "cdc51051-ea07-11e7-b7ae-025c31abfac0",
"resourceVersion": "185",
"creationTimestamp": "2017-12-26T06:41:29Z",
"labels": {
"kubernetes.io/hostname": "ip-10-10-10-10"
},
"Spec": {
"PodCIDR": "",
"ExternalID": "ip-10-10-10-10",
"ProviderID": "",
"Unschedulable": false,
"Taints": null,
"ConfigSource": null
},
"Status": {
"Capacity": {
"cpu": "0",
"memory": "0",
"pods": "40"
},
"Allocatable": {
"cpu": "0",
"memory": "0",
"pods": "40"
},
"Phase": "",
"Conditions": [
{
"Type": "Ready",
"Status": "True",
"LastHeartbeatTime": "2017-12-26T07:03:01Z",
"LastTransitionTime": "2017-12-26T06:41:29Z",
I have this as a.yml:
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 2
selector:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80I run this:
kubectl create -f a.ymlI get this:
Error from server (NotFound): the server could not find the requested
resource
I expected the above command to create a pod.
I ran this:
kubectl cluster-info dumpI got this:
```
{
"selfLink": "/api/v1/nodes",
"resourceVersion": "185",
"Items": [
{
"name": "ip-10-10-10-10",
"selfLink": "/api/v1/nodes/ip-10-10-10-10",
"uid": "cdc51051-ea07-11e7-b7ae-025c31abfac0",
"resourceVersion": "185",
"creationTimestamp": "2017-12-26T06:41:29Z",
"labels": {
"kubernetes.io/hostname": "ip-10-10-10-10"
},
"Spec": {
"PodCIDR": "",
"ExternalID": "ip-10-10-10-10",
"ProviderID": "",
"Unschedulable": false,
"Taints": null,
"ConfigSource": null
},
"Status": {
"Capacity": {
"cpu": "0",
"memory": "0",
"pods": "40"
},
"Allocatable": {
"cpu": "0",
"memory": "0",
"pods": "40"
},
"Phase": "",
"Conditions": [
{
"Type": "Ready",
"Status": "True",
"LastHeartbeatTime": "2017-12-26T07:03:01Z",
"LastTransitionTime": "2017-12-26T06:41:29Z",
Solution
As per https://kubernetes.io/docs/tasks/tools/install-kubectl/#before-you-begin:
You must use a kubectl version that is within one minor version difference of your cluster. For example, a v1.2 client should work with v1.1, v1.2, and v1.3 master. Using the latest version of kubectl helps avoid unforeseen issues.
So you need to either downgrade your kubectl version or upgrade your cluster version.
You must use a kubectl version that is within one minor version difference of your cluster. For example, a v1.2 client should work with v1.1, v1.2, and v1.3 master. Using the latest version of kubectl helps avoid unforeseen issues.
So you need to either downgrade your kubectl version or upgrade your cluster version.
Context
StackExchange DevOps Q#2956, answer score: 7
Revisions (0)
No revisions yet.