Kubernetes control plane is running at https://127.0.0.1:64053
CoreDNS is running at https://127.0.0.1:64053/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
What it is:
The "control plane" is the brain of your Kubernetes cluster. It's a collection of processes that manage the overall state of the cluster.
Components of Control Plane:
kube-apiserver: Front-end that exposes Kubernetes API (what you're connecting to)
etcd: Distributed key-value store (cluster database)
kube-scheduler: Assigns pods to nodes
kube-controller-manager: Runs controller processes
cloud-controller-manager: Manages cloud provider specifics
What "running at https://127.0.0.1:64053" means:
Your Kubernetes API server is accessible locally on port 64053
kubectl commands communicate with this endpoint
This is your gateway to manage the cluster
2. CoreDNS
What it is:
CoreDNS is the DNS server for your Kubernetes cluster. It provides service discovery and DNS resolution within the cluster.
Why Kubernetes Needs DNS:
Service Discovery Example:
# Without DNS - you'd need to know IP addresses
apiVersion: v1
kind: Pod
metadata:
name: frontend
spec:
containers:
- name: app
image: nginx
env:
- name: BACKEND_URL
value: "10.244.1.5:8080" # Hard-coded IP - BAD!
# With DNS - use service names
apiVersion: v1
kind: Pod
metadata:
name: frontend
spec:
containers:
- name: app
image: nginx
env:
- name: BACKEND_URL
value: "backend-service.dev.svc.cluster.local:8080" # DNS name - GOOD!
Real-world Examples of CoreDNS in Action
Example 1: Service-to-Service Communication
# Database Service
apiVersion: v1
kind: Service
metadata:
name: database
namespace: dev
spec:
selector:
app: postgres
ports:
- port: 5432
---
# Application Pod that connects to database
apiVersion: v1
kind: Pod
metadata:
name: web-app
namespace: dev
spec:
containers:
- name: app
image: my-app:latest
env:
- name: DB_HOST
value: "database.dev.svc.cluster.local" # CoreDNS resolves this!
- name: DB_PORT
value: "5432"
Example 2: Pods Finding Each Other
# From inside any pod, you can resolve services:
nslookup database.dev.svc.cluster.local
# CoreDNS resolves this to the service IP
DNS Resolution Hierarchy in Kubernetes
CoreDNS resolves names in this order:
Pod-name.namespace.pod.cluster.local (individual pods)
service.namespace.svc.cluster.local (services)
External DNS names (google.com, etc.)
How CoreDNS Works with Your FastAPI Application
apiVersion: v1
kind: Service
metadata:
name: app-svc
namespace: dev
spec:
selector:
app: llm-api
ports:
- port: 8000
CoreDNS allows:
Pods in dev namespace to find your service via app-svc.dev.svc.cluster.local
Other services to communicate with your FastAPI app
Ingress controller to route traffic to your service
No comments:
Post a Comment