Kubernetes
Networking
Port 80
Cloud Computing
DevOps

Accessing Kubernetes service on port 80

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

Kubernetes has emerged as a leading platform for automating deployment, scaling, and operations of application containers. One of the key functionalities in Kubernetes is its ability to handle application networking using Services. In this article, we'll explore accessing a Kubernetes Service configured on port 80, a common requirement for web applications.

Understanding Kubernetes Services

Kubernetes services are an abstraction which define a logical set of Pods and a policy by which to access them. Services enable seamless communication in a dynamic environment where IP addresses of Pods can frequently change.

Types of Services

Kubernetes supports several types of services:

  1. ClusterIP (default): Exposes the Service on a cluster-internal IP. It is accessible only from within the cluster.
  2. NodePort: Exposes the Service on each Node's IP at a static port.
  3. LoadBalancer: Exposes the Service externally using a cloud provider's load balancer.
  4. ExternalName: Maps the service to the contents of the `externalName` field (e.g., foo.bar.example.com).

Each of these plays a different role based on the required exposure of the application.

Configuring a Service on Port 80

Exposing services on port 80 is common for web applications. We'll cover the configuration needed for ClusterIP, NodePort, and LoadBalancer services to achieve this.

1. ClusterIP Example

  • protocol: TCP
  • protocol: TCP
  • protocol: TCP
  • ClusterIP: Use `kubectl port-forward` to access the service locally or deploy a proxy Pod in the cluster.
  • NodePort: Access through the external IP of any node followed by the `NodePort` (e.g., `http://node-ip:30000\`).
  • LoadBalancer: Access through the external IP addressed by the cloud provider's load balancer (e.g., DNS or IP).
  • Ensure your firewall settings allow traffic on the desired ports.
  • Be mindful of security and authentication when exposing services externally.
  • Remember that each type has specific cloud provider requirements and configuration nuances.

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.