Cant see my nodes when typing 'kubectl get nodes'

1/11/2018

I am trying to create cluster with Kops, In my script I take a directory called instancegroup and copy its contant inside my "state" S3 bucket. When the cluster is being created I can see in Amazon console that all my nodes where deployed (master, 2 default nodes, and 5 nodes that I specifed inside my instancegroup directory).

Problem is that when typing :

kubectl get nodes

I only get the master machine and the 2 default nodes.

Is that the right way to create such cluster? And why cant I see my other nodes?

-- Shachar Hamuzim Rajuan
amazon-ec2
kops
kubernetes

2 Answers

1/11/2018

get nodes only lists registered Node API objects. The other nodes must not be registering themselves with the API server. Check the logs for the kubelet process on those nodes to determine why they aren't registering themselves.

-- Jordan Liggitt
Source: StackOverflow

1/14/2018

The problem was with my instanswegroup file for all the nodes I specified, in the line that specify the "instancegroup" I changed the "nodes" in to the name of the name of my "instancegroup" and this is why kubernetes didn't recognize them as nodes.

kops.k8s.io/instancegroup: elk

This is an example of the file that is working after the fix:

apiVersion: kops/v1alpha2
kind: InstanceGroup
metadata:
  creationTimestamp: 2018-01-03T10:45:43Z
  labels:
    kops.k8s.io/cluster: 
  name: elk
spec:
  image: ami-3fa07b47
  machineType: t2.micro
  maxSize: 1
  minSize: 1
  nodeLabels:
    kops.k8s.io/instancegroup: nodes
    nodegroup: "elk-nodes"
    frontendnodes: "y"
  role: Node
  subnets:
  - us-west-2a
-- Shachar Hamuzim Rajuan
Source: StackOverflow