Hello Kubernetes!

Learn to Deploy and Expose Services to the Internet

🎯 Welcome to Your K8s Journey

This application demonstrates how to deploy a containerized web application to Kubernetes and expose it to the internet using Deployment, Service, and Ingress.

πŸ“¦ Step 1: Deployment

A Deployment manages your application's replicas and ensures the desired state is maintained.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-world
spec:
  replicas: 3
  selector:
    matchLabels:
      app: hello-world
  template:
    metadata:
      labels:
        app: hello-world
    spec:
      containers:
      - name: nginx
        image: harbor.bssconnects.io/rnd/hello-world:latest
        ports:
        - containerPort: 80

πŸ’‘ Tip: Deployments handle rolling updates and rollbacks automatically!

🌐 Step 2: Service

A Service provides a stable network endpoint to access your Pods.

apiVersion: v1
kind: Service
metadata:
  name: hello-world
spec:
  type: ClusterIP
  selector:
    app: hello-world
  ports:
  - port: 80
    targetPort: 80

πŸ’‘ ClusterIP: Internal-only access (default type)

πŸšͺ Step 3: Ingress

An Ingress routes HTTP(S) traffic from the internet to your Service.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: hello-world
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-staging
spec:
  ingressClassName: nginx
  tls:
  - hosts:
    - hello-world.bssconnects.io
    secretName: hello-world-tls
  rules:
  - host: hello-world.bssconnects.io
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: hello-world
            port:
              number: 80

πŸ’‘ cert-manager automatically provisions TLS certificates from Let's Encrypt!

πŸ”§ Additional Tools Used

  • NGINX Ingress Controller: Implements Ingress rules and handles traffic routing
  • cert-manager: Automates TLS certificate provisioning and renewal
  • external-dns: Automatically creates DNS records for your Ingress hosts
  • Harbor: Private container registry at harbor.bssconnects.io

βœ… Deployment Commands

# Build and push the Docker image
docker build -t harbor.bssconnects.io/rnd/hello-world:latest .
docker push harbor.bssconnects.io/rnd/hello-world:latest

# Apply Kubernetes manifests
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
kubectl apply -f ingress.yaml

# Check the deployment status
kubectl get pods
kubectl get svc
kubectl get ingress

πŸ“Š Live Status

Pod Count: Loading...
Service Type: ClusterIP
Ingress Host: hello-world.bssconnects.io
TLS: βœ“ Enabled