1.19 kubernetes - amresh087/Question GitHub Wiki
Aws EKs

-
Kubernetes master node and worker node explanation Answer
-
Kubernetes Local Setup Answer
-
Minikube Local Setup Requirement Answer
-
Kubernetes Command Answer
-
Additional Kubernetes Objects Answer
-
Assessments Demo Answer
-
Kubernetes components ? Answer
-
Kubernetes all commands ? Answer
-
Kubernetes API Basics - Resources, Kinds, and Objects ? Answer
Kubernetes | What and Why
Before Kubernetes you can perform load balance by using Beanstalk





Kubernetes: Adding Configuration Files
we need to create two config files
- client-pod.yml

- client-node-port.yml (it is for networking)

Kubernetes: Object Types and API Versions

📦 Pod → (Your App)
Smallest unit
Pod = Container (Spring Boot app)
🔄 Deployment → (Manager)
Manages pods
- create
- update
- scale
🌐 Service → (Network)
Exposes your app
User → Service → Pod
🔁 ReplicaSet → (Backup)
Ensures number of pods
🔐 ConfigMap / Secret → (Config)
ConfigMap → normal config
Secret → password
👷 DaemonSet → (Run everywhere)
Runs on all nodes
🧱 StatefulSet → (Database apps)
Used for DB / Kafka
⏳ Job → (One-time task)
Run once and stop
Kubernetes: Service Config Files in Depth

ClusterIP, NodePort, LoadBalancer, and ExternalName are different types of services in Kubernetes, which allow you to expose your application to the network.
1. ClusterIP:
🟢 ClusterIP (Default)
type: ClusterIP
👉 Internal access only
👉 Used for microservices communication
Only inside cluster

2. NodePort:
This type of service exposes the pods on a specific port on each node in the cluster. This allows external
traffic to be directed to the pods through any node in the cluster. NodePort services are accessible from
outside the cluster using the node's IP address and the port number.
NodePort
type: NodePort
👉 Exposes app on node IP
http://node-ip:30007

3. LoadBalancer:
This type of service is used when you have an external load balancer that can route traffic to the pods.
The LoadBalancer service provides an external IP address that can be used to access the pods through the
load balancer. This type of service is only available if your Kubernetes cluster is running in a cloud
environment that supports external load balancers.
🔴 LoadBalancer
type: LoadBalancer
👉 Used in cloud (AWS, Azure)
👉 Creates external load balancer

4. ExternalName:
This type of service is used to map a service name to an external DNS name. When a client within the
Kubernetes cluster tries to access the service, the DNS name is resolved to an IP address using the
external DNS server. This is useful when you have a service that's not running within the Kubernetes
cluster, but you still want to be able to access it using a service name.
🟡 ExternalName
👉 Maps to external service (DNS)

🧠 What is Ingress in Kubernetes?
Ingress is used to expose multiple services using a single entry point (HTTP/HTTPS).
🎯 Simple Problem
Without Ingress:
Service1 → NodePort (30001)
Service2 → NodePort (30002)
Service3 → NodePort (30003)
👉 Too many ports ❌
👉 Hard to manage ❌
✅ With Ingress
www.myapp.com/payment → Payment Service
www.myapp.com/order → Order Service
👉 One domain, smart routing ✅
🧠 Key Idea
Ingress = HTTP Router (like API Gateway)
🏗️ How It Works
User → Ingress → Service → Pod
🧩 Important Components
🔹 1. Ingress Resource (Rules)
👉 Defines routing rules
🔹 2. Ingress Controller (Engine)
👉 Actually processes requests
Examples:
NGINX Ingress Controller
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
spec:
rules:
- host: myapp.com
http:
paths:
- path: /payment
pathType: Prefix
backend:
service:
name: payment-service
port:
number: 80
- path: /order
pathType: Prefix
backend:
service:
name: order-service
port:
number: 80