Skip to content

"kubectl get nodes" return "no resources found"

0

I have a vpc, a subnet in Casablanca wavelenght for the worker nodes and subnets in an AZ in Paris for the control plans, when I run "kubectl get nodes", I got "no resources found", and I think because the worker nodes are not registring in the control plans, but why ? when I did a research, I conclude that the issue might be because user data doesn't have the correct code to join the cluster, or the aws-auth doesn't have the role that the worker nodes have, or security group is not allowing the communication, but all this solutions are checked for me and still have the issue. here's my userdata : #!/bin/bash

set -ex

/etc/eks/bootstrap.sh ${cluster_name}
--apiserver-endpoint "${cluster_endpoint}"
--b64-cluster-ca "${cluster_ca}"
--dns-cluster-ip "${dns_ip}"
--container-runtime containerd
--kubelet-extra-args "--max-pods=${max_pods}"
--use-max-pods false

and here's my aws-auth : module "aws_auth" { source = "../../modules/aws-auth" cluster_name = module.eks.cluster_name cluster_endpoint = module.eks.cluster_endpoint cluster_ca_certificate = module.eks.certificate_authority worker_roles = [module.eks_node_group_iam_role.role_arn] } modules/aws-auth: provider "kubernetes" { host = var.cluster_endpoint token = data.aws_eks_cluster_auth.cluster.token cluster_ca_certificate = base64decode(var.cluster_ca_certificate) }

data "aws_eks_cluster_auth" "cluster" { name = var.cluster_name }

resource "kubernetes_config_map" "aws_auth" { metadata { name = "aws-auth" namespace = "kube-system" }

data = { mapRoles = yamlencode([ for arn in var.worker_roles : { rolearn = arn username = "system:node:{{EC2PrivateDNSName}}" groups = [ "system:bootstrappers", "system:nodes" ] } ]) } } and here's my security groups : resource "aws_security_group" "worker_nodes" { name = "${var.cluster_name}-worker-nodes-sg" description = "Security group for EKS worker nodes" vpc_id = var.vpc_id

ingress { description = "Allow node-to-node communication" from_port = 0 to_port = 0 protocol = "-1" self = true }

ingress { description = "Allow EKS control plane to communicate with nodes" from_port = 443 to_port = 443 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] # change it after to the control plans subnets }

egress { description = "Allow outbound HTTPS traffic to EKS control plane" from_port = 443 to_port = 443 protocol = "tcp" cidr_blocks =["0.0.0.0/0"] }

tags = { Name = "${var.cluster_name}-worker-sg" } } so the issue might be comming from where ?

asked a year ago449 views

1 Answer
0

When you run "kubectl get nodes" and get "no resources found", it typically means your worker nodes are not successfully joining the EKS cluster. Based on your setup with worker nodes in Casablanca Wavelength and control plane in Paris, there are several potential causes for this issue:

  1. Cross-region connectivity issues: Having your worker nodes in Wavelength zones (Casablanca) and your control plane in a different region (Paris) might cause connectivity problems. The worker nodes need to be able to communicate with the control plane endpoint.

  2. Bootstrap script execution: While your bootstrap script looks correct, you should verify that it's actually executing successfully on the worker nodes. Check the instance logs in EC2 console or use Systems Manager to access the nodes and check /var/log/cloud-init-output.log for any errors during bootstrap.

  3. IAM authentication: Ensure that the IAM role used by your worker nodes has the necessary permissions to join the cluster. The role ARN in your aws-auth ConfigMap should match exactly with the role used by the worker nodes.

  4. Security group configuration: Your security group allows inbound traffic on port 443 from anywhere (0.0.0.0/0), but you might need to ensure that all required ports for kubelet communication are open. The worker nodes need to communicate with the control plane on multiple ports.

  5. Network connectivity: Check if there are any network ACLs, route tables, or other network configurations that might be blocking traffic between your Wavelength zone and the region where your control plane is located.

  6. kubectl configuration: Verify that your kubectl is properly configured to communicate with your EKS cluster. Run aws eks update-kubeconfig --name <your-cluster-name> --region <your-region> to ensure your kubeconfig is up to date.

  7. Authentication issues: Run aws sts get-caller-identity to verify you're using the correct IAM credentials that have access to the cluster.

To further troubleshoot, check the EC2 instance logs of your worker nodes to see if they're attempting to join the cluster and what errors they might be encountering. Also, verify that your EKS cluster's API server endpoint is accessible from the Wavelength zone.
Sources
Error while creating EKS cluster | AWS re:Post
EKS node creation failed | AWS re:Post
Troubleshoot problems with Amazon EKS clusters and nodes - Amazon EKS
Troubleshot IAM role issues in Amazon EKS | AWS re:Post

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.