Kubernetes
Amazon Web Services
SSH
Cloud Computing
DevOps

SSH into Kubernetes cluster running on Amazon

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

Secure Shell (SSH) is a cryptographic network protocol used for operating network services securely over an unsecured network. In the context of Kubernetes, SSH can be used to access nodes within a cluster. On Amazon's Elastic Kubernetes Service (EKS), SSH access can be instrumental for diagnosing issues directly on nodes or performing specific administrative tasks.

Infrastructure Overview

Amazon EKS is a managed Kubernetes service that simplifies running Kubernetes on the cloud. It leverages EC2 (Elastic Compute Cloud) instances for the worker nodes. These nodes can be accessed via SSH, providing direct access to the server’s operating system. Understanding how to SSH into these nodes is critical for in-depth cluster management.

Prerequisites

To SSH into a Kubernetes cluster running on Amazon, you'll need the following:

  • AWS Account: Signed up for Amazon Web Services.
  • IAM Permissions: Appropriate permissions to access and manage EKS and EC2.
  • AWS CLI: Command-line interface installed and configured with access credentials.
  • kubectl: Kubernetes command-line tool configured for your EKS cluster.
  • SSH Key Pair: A key pair registered with EC2. You should have the private key available.
  • EKS Cluster: A running Kubernetes cluster on Amazon EKS.

SSH Access to EC2 Worker Nodes

  1. Retrieve EC2 Worker Nodes: First, list your worker nodes using kubectl .
  • Monitoring Logs: Accessing system logs directly from nodes.
  • Networking Issues: Verifying IP routes and network configurations.
  • Performance Tuning: Making changes to the OS for performance testing.
  • A Bastion Host (or jump server) is an intermediary used to access instances in a private network.
  • Deploy an EC2 instance with SSH access and security group allowing inbound traffic from trusted IPs.
  • From the Bastion Host, SSH into private network instances.
  • Limit SSH Access: Keep SSH access to a minimum and restrict by IP.
  • Use SSH agent forwarding: This secures private keys by storing them on your local machine instead of the remote node.
  • Automated Scripts: Use scripts for repetitive tasks while SSHed into the nodes.
  • Auditing and Logging: Enable AWS CloudTrail to audit operational tasks performed over SSH for security and compliance.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.