Overview
Rancher provides native integration with Amazon Elastic Kubernetes Service (EKS) through theClusterDriverEKS driver. This enables full lifecycle management of EKS clusters including provisioning, updating, and importing existing clusters.
Cluster Driver
Driver Name:EKS
Defined in: pkg/apis/management.cattle.io/v3/cluster_types.go:83
Configuration Spec
EKS clusters are configured using theEKSClusterConfigSpec structure.
Cluster Spec Fields
Authentication Configuration
amazonec2credentialConfig-accessKey: AWS access key IDamazonec2credentialConfig-secretKey: AWS secret access key
pkg/controllers/management/eks/eks_cluster_handler.go:583-587
Networking Configuration
- VPC (Virtual Network)
- Subnets across availability zones
- Security groups
- Internet gateway and route tables
pkg/controllers/management/eks/eks_cluster_handler.go:230-252
Node Group Configuration
Security Configuration
Advanced Features
EKS Operator Integration
Rancher uses the EKS operator to manage cluster lifecycle through Custom Resource Definitions (CRDs). Operator Template:system-library-rancher-eks-operator
API Group: eks.cattle.io
Resource: eksclusterconfigs
Source: pkg/controllers/management/eks/eks_cluster_handler.go:47-50
Lifecycle Management
The EKS operator controller handles cluster state transitions:Creating Phase
- Cluster resources are being provisioned in AWS
ClusterConditionProvisionedset to Unknown- Upstream spec is initialized
pkg/controllers/management/eks/eks_cluster_handler.go:156-173
Active Phase
- Cluster is provisioned and running
- Service account token is generated
- Network details are copied to cluster status
ClusterConditionProvisionedset to True
pkg/controllers/management/eks/eks_cluster_handler.go:174-345
Updating Phase
- Cluster configuration is being updated
ClusterConditionUpdatedset to Unknown- Changes are synchronized to EKSClusterConfig CRD
pkg/controllers/management/eks/eks_cluster_handler.go:346-358
EKSClusterConfig Custom Resource
When a cluster is created, Rancher automatically generates anEKSClusterConfig CRD:
pkg/controllers/management/eks/eks_cluster_handler.go:475-504
Cluster Status
The EKS cluster status provides detailed information:pkg/apis/management.cattle.io/v3/cluster_types.go:411-420
Authentication & API Access
AWS IAM Authenticator
Rancher uses AWS IAM authenticator to generate bearer tokens for EKS API access:pkg/controllers/management/eks/eks_cluster_handler.go:602-621
REST Config
The controller creates a Kubernetes REST config using:- EKS API endpoint
- CA certificate (base64 decoded)
- IAM authenticator bearer token
pkg/controllers/management/eks/eks_cluster_handler.go:623-642
Private Cluster Support
For clusters with only private API endpoints (publicAccess: false), Rancher determines if tunneling is required.
Tunnel Detection
Rancher attempts to connect to the private API endpoint directly:- DNS Resolution Fails: Requires tunnel
- Connection Timeout: Requires tunnel
- Connection Succeeds: Direct access possible
pkg/controllers/management/eks/eks_cluster_handler.go:535-566
Service Account Token Generation
For private clusters:- If direct access: Token generated immediately
- If tunnel required: Wait for cluster agent deployment
- Token stored in secret:
cluster.Status.ServiceAccountTokenSecret
pkg/controllers/management/eks/eks_cluster_handler.go:262-283
Node Group Requirements
Important: EKS clusters must have at least one node to run the cluster agent. If no node groups exist:ClusterConditionWaitingset to False- Message: “Cluster must have at least one managed nodegroup or one self-managed node.”
pkg/controllers/management/eks/eks_cluster_handler.go:202-221
Provisioning Workflow
- Create Cluster Object: Define cluster with
spec.eksConfig - Credential Validation: Validate AWS credentials
- CRD Creation: EKSClusterConfig CRD is created
- Resource Provisioning: EKS operator provisions:
- EKS control plane
- VPC and networking (if not provided)
- Node groups
- Security groups
- Status Synchronization: Network details copied to cluster status
- Service Account: Generate and store service account token
- Agent Deployment: Rancher cluster agent deployed
- Active State: Cluster ready for workloads
Importing Existing Clusters
To import an existing EKS cluster:- Rancher registers the cluster without modification
- Node groups are discovered from AWS
ClusterConditionPendingtransitions from Unknown to True
pkg/controllers/management/eks/eks_cluster_handler.go:185-193
Launch Templates
Rancher tracks managed launch templates for node groups:- Managed Launch Template ID: Shared template ID
- Template Versions: Per-node-group version mapping
pkg/controllers/management/eks/eks_cluster_handler.go:306-328
Best Practices
Networking
- Use private subnets for worker nodes
- Enable both public and private API access during setup
- Use
publicAccessSourcesto restrict API access - Ensure subnet has sufficient IP addresses for pod networking
Security
- Enable secrets encryption with KMS
- Enable CloudWatch logging for audit trails
- Use IAM roles for service accounts (IRSA)
- Rotate AWS credentials regularly
- Use private clusters when possible
Node Groups
- Use managed node groups for simplified management
- Enable autoscaling for dynamic workloads
- Use multiple node groups for different instance types
- Consider spot instances for cost optimization
High Availability
- Deploy across multiple availability zones
- Use subnets in different AZs
- Configure appropriate node group sizes
Troubleshooting
403 Access Denied
Verify IAM permissions include:eks:*permissions for EKS operationsec2:*for networking resourcesiam:PassRolefor service roles
pkg/controllers/management/eks/eks_cluster_handler.go:152-154
Node Group Not Creating
Check:- Node IAM role has required policies
- Subnets have available IP addresses
- Security groups allow required traffic
- Launch template configuration is valid
Agent Not Deploying
For private clusters:- Verify
privateRequiresTunnelstatus - Check if import command was executed
- Ensure at least one node group exists
pkg/controllers/management/eks/eks_cluster_handler.go:289-295
Update Failures
If updates fail:- Check EKSClusterConfig status.failureMessage
- Verify node group versions are compatible
- Ensure Kubernetes version upgrades are incremental
pkg/controllers/management/eks/eks_cluster_handler.go:354-358
Related Resources
API Reference
Cluster Type Definition
Location:pkg/apis/management.cattle.io/v3/cluster_types.go:162
Controller Registration
Location:pkg/controllers/management/eks/eks_cluster_handler.go:61-86
The EKS operator controller is registered to watch cluster changes and reconcile state with AWS EKS.