> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Demo Deploying All Apps Into Kubernetes Cluster

> Deploying Skyline Air microservices into a Kubernetes cluster using per-service namespaces and a kustomize overlay, verifying rollouts and port-forwarding the booking UI for local testing.

Welcome back. In this lesson we'll deploy the Skyline Air microservices into a Kubernetes cluster. We'll create isolated namespaces for each service, apply the kustomize overlay to create all required resources, verify the rollout, and port-forward the booking frontend for local testing.

## Creating namespaces

Each microservice gets its own namespace so teams can manage resources independently and apply RBAC or resource quotas per namespace. Create the namespaces used by the Skyline Air demo:

```bash theme={null}
# create namespaces
kubectl create namespace booking-api
kubectl create namespace flight-search
kubectl create namespace inventory
kubectl create namespace payment
kubectl create namespace airline
```

Using one namespace per microservice helps isolate resources, simplify monitoring, and enables team-level ownership (RBAC, quotas, network policies).

Example output:

```console theme={null}
namespace/booking-api created
namespace/flight-search created
namespace/inventory created
namespace/payment created
namespace/airline created
```

Verify the namespaces:

```bash theme={null}
kubectl get namespace
```

Representative output:

```console theme={null}
NAME                       STATUS    AGE
airline                    Active    28s
booking-api                Active    36s
default                    Active    2m43s
flight-search              Active    28s
inventory                  Active    28s
kube-node-lease            Active    2m44s
kube-public                Active    2m44s
kube-system                Active    2m44s
local-path-storage         Active    2m39s
payment                    Active    28s
```

## Deploying with Kustomize

We use a `kustomization.yaml` overlay to deploy all manifests together. Apply the overlay directory with `kubectl apply -k` to create ConfigMaps, Services, PVCs, Deployments, Ingress, and other resources in the correct namespaces:

```bash theme={null}
kubectl apply -k sections/02-airline-app-deployment/manifests/airline-k8-deployment/
```

Example output (resources created):

```console theme={null}
configmap/booking-api-config created
configmap/analytics-config created
configmap/untracked-config created
configmap/flight-search-config created
configmap/inventory-config created
configmap/payment-config created
service/booking-api created
service/analytics-collector created
service/flight-search-service created
service/inventory-service created
service/payment-processor created
persistentvolumeclaim/orphaned-data-pvc created
persistentvolumeclaim/booking-api-data created
persistentvolumeclaim/analytics-data created
persistentvolumeclaim/flight-search-data created
persistentvolumeclaim/inventory-data created
persistentvolumeclaim/payment-logs created
deployment.apps/booking-api created
deployment.apps/analytics-collector created
deployment.apps/flight-search-service created
deployment.apps/inventory-service created
deployment.apps/payment-processor created
ingress.networking.k8s.io/booking-api created
```

Summary of resources created by the overlay:

| Resource Type | Purpose |
| -: | - |
| ConfigMap | Environment/configuration for each microservice |
| Service | Internal connectivity and stable cluster IPs |
| PersistentVolumeClaim | Persistent storage for stateful components |
| Deployment | Replica sets and pod management for each service |
| Ingress | External HTTP routing for the booking UI and APIs |

## Verifying the rollout

Run a consolidated set of checks to confirm pods, services, deployments, and replicasets were created and are healthy:

```bash theme={null}
# Example consolidated checks (run individually as needed)
kubectl get pods --all-namespaces
kubectl get svc --all-namespaces
kubectl get deployments --all-namespaces
kubectl get replicasets --all-namespaces
```

Representative (trimmed) output showing the application components in their namespaces:

```console theme={null}
# Pods
booking-api                 pod/booking-api-84d8f89488-45r9f             1/1   Running   0   35s
default                     pod/analytics-collector-6f7d85c8fd-4flvx    1/1   Running   0   35s
flight-search               pod/flight-search-service-5678746b86-hbrpw  1/1   Running   0   35s
inventory                   pod/inventory-service-69cc899bd8-7px71      1/1   Running   0   35s
local-path-storage          pod/local-path-provisioner-547f784dff-z4mm8 1/1   Running   0   14m
payment                     pod/payment-processor-789f68f867-krqkb      1/1   Running   0   35s

# Services
NAMESPACE        NAME                         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)     AGE
booking-api      service/booking-api          ClusterIP   10.96.142.162   <none>        8080/TCP    35s
default          service/analytics-collector  ClusterIP   10.96.83.7      <none>        80/TCP      35s
flight-search    service/flight-search-service ClusterIP 10.96.138.97    <none>        80/TCP      35s
inventory        service/inventory-service    ClusterIP   10.96.48.16     <none>        8080/TCP    35s
payment          service/payment-processor    ClusterIP   10.96.73.63     <none>        8443/TCP    35s

# Deployments
NAMESPACE        NAME                                    READY   UP-TO-DATE   AVAILABLE   AGE
booking-api      deployment.apps/booking-api             1/1     1            1           35s
default          deployment.apps/analytics-collector    1/1     1            1           35s
flight-search    deployment.apps/flight-search-service  1/1     1            1           35s
inventory        deployment.apps/inventory-service      1/1     1            1           35s
local-path-storage deployment.apps/local-path-provisioner 1/1  1       1           14m
payment          deployment.apps/payment-processor      1/1     1            1           35s

# ReplicaSets
NAMESPACE        NAME                                              DESIRED   CURRENT   READY   AGE
booking-api      replicaset.apps/booking-api-84d8f89488            1         1         1       35s
default          replicaset.apps/analytics-collector-6f7d85c8fd    1         1         1       35s
flight-search    replicaset.apps/flight-search-service-5678746b86  1         1         1       35s
inventory        replicaset.apps/inventory-service-69cc899bd8      1         1         1       35s
local-path-storage replicaset.apps/local-path-provisioner-547f784dff 1 1  1       14m
payment          replicaset.apps/payment-processor-789f68f867     1         1         1       35s
```

Everything looks good when pods show Running and deployments have the expected READY/AVAILABLE counts.

## Port-forwarding the booking-api UI

To test the Skyline Air booking UI locally, port-forward the `booking-api` service and bind it to localhost:

```bash theme={null}
kubectl port-forward -n booking-api svc/booking-api 8080:8080 --address 127.0.0.1
```

Using `--address 127.0.0.1` binds the port-forward to the loopback interface. This ensures the port-forward only listens on the local machine and helps avoid exposing the service on all network interfaces.

Open your browser and navigate to:

```text theme={null}
http://127.0.0.1:8080
```

You should see the Skyline Air web UI. Perform a search and complete a booking and payment to confirm the end-to-end communication between the microservices.

![Screenshot of a flight-booking page for "Sky Route." The search form shows an open "From" dropdown with cities (Mumbai, Delhi, Bangalore, etc.), "To" set to New York (NYC), a departure date, passenger selector, and a large "Search Flights" button.](https://mintcdn.com/kodekloud-c4ac6d9a/rjGeTDj8cr6D5YbW/images/Building-Kubernetes-FinOps-AI-Agent/Setting-Up-SkyLine-Air-Kubernetes-Services/Demo-Deploying-All-Apps-Into-Kubernetes-Cluster/skyroute-flight-search-mumbai-to-nyc.jpg?fit=max\&auto=format\&n=rjGeTDj8cr6D5YbW\&q=85\&s=401ec3022f34b98b4c1fd8259e5beaa4)

## Summary

* Each microservice runs in its own namespace and is deployed via a kustomize overlay.
* The overlay created ConfigMaps, Services, PVCs, Deployments, and an Ingress for external routing.
* Verify deployments, services, and pods with `kubectl get` commands across namespaces.
* Use `kubectl port-forward` for safe local access to the booking UI.

Inspect labels and annotations across namespaces to confirm consistent metadata and ownership. Proper labeling makes it easier to search, monitor, and apply policy selectively.

## Links and references

* Kustomize: [https://kustomize.io/](https://kustomize.io/)
* kubectl documentation: [https://kubernetes.io/docs/reference/kubectl/](https://kubernetes.io/docs/reference/kubectl/)
* Kubernetes concepts: [https://kubernetes.io/docs/concepts/](https://kubernetes.io/docs/concepts/)

> **[Watch Video](https://learn.kodekloud.com/user/courses/building-kubernetes-finops-ai-agent/module/bd335eac-9e8a-4dc2-963b-1db50f6971f9/lesson/610ce1f2-4f2c-4018-b863-31fead1a9f15)**

> **[Practice Lab](https://learn.kodekloud.com/user/courses/building-kubernetes-finops-ai-agent/module/bd335eac-9e8a-4dc2-963b-1db50f6971f9/lesson/8b0883e1-781b-42aa-8275-f54170d9fc95)**


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.