@@ -293,7 +293,7 @@ With this we can able to:**
293293## Deploy on Bare Metal
294294** To deploy on a “production-like” environment without Kubernetes — just Docker + Nginx on a Vagrant box.**
295295
296- #### Key Points
296+ ### Key Points
297297
298298- Vagrantfile creates a VM (e.g., Ubuntu).
299299- A provisioning script installs Docker, Docker Compose, Nginx.
@@ -323,7 +323,7 @@ server {
323323
324324** Spin up a 3-node Kubernetes cluster with Minikube.**
325325
326- #### Key Points
326+ ### Key Points
327327
328328- ** Start minikube with 3 nodes:**
329329 ``` sh
@@ -337,13 +337,28 @@ server {
337337
338338- This enforces workload isolation (apps on one node, DB on another, monitoring tools on another).
339339
340+ ### Minikube Cluster setup commands
341+
342+ ``` sh
343+ # Start a 3-node cluster
344+ minikube start --nodes 3
345+
346+ # Check all nodes
347+ kubectl get nodes -o wide
348+
349+ # Label nodes for workload separation
350+ kubectl label node minikube type=application
351+ kubectl label node minikube-m02 type=database
352+ kubectl label node minikube-m03 type=dependent_services
353+ ```
354+
340355** At the end: "we have a real K8s cluster with node roles".**
341356
342357## Deploy API, DB and other services in Kubernetes
343358
344359** Move from Docker Compose → Kubernetes deployment.**
345360
346- #### Key Points
361+ ### Key Points
347362
348363- ** Manifests should be modular:**
349364 - ** application.yml** → namespace, configmap, secret, deployment, service for API.
@@ -359,4 +374,66 @@ server {
359374- ** Namespace isolation** → student-api for app + db, others for observability.
360375- ** Test via Postman** : all endpoints should work and return 200.
361376
377+ ### K8s deployment and verification commands
378+
379+ - ** Deploy API + DB**
380+ ``` sh
381+ kubectl apply -f k8s/database.yml
382+ kubectl apply -f k8s/application.yml
383+ ```
384+
385+ - ** Deploy Vault + ESO**
386+ ``` sh
387+ kubectl apply -f k8s/vault.yml
388+ kubectl apply -f k8s/external-secrets.yml
389+ ```
390+ - ** Verify Deployments**
391+ ``` sh
392+ # Check namespaces
393+ kubectl get ns
394+
395+ # Check pods
396+ kubectl get pods -n student-api
397+
398+ # Check deployments
399+ kubectl get deployments -n student-api
400+
401+ # Check services
402+ kubectl get svc -n student-api
403+ ```
404+ - ** Debugging**
405+ ``` sh
406+ # Describe pod for events/logs
407+ kubectl describe pod < pod-name> -n student-api
408+
409+ # View container logs
410+ kubectl logs -f < pod-name> -n student-api
411+
412+ # Exec into a running pod
413+ kubectl exec -it < pod-name> -n student-api -- /bin/sh
414+ ```
415+ - ** Port Forward (if no LoadBalancer)**
416+ ``` sh
417+ kubectl port-forward svc/student-api-service 8080:80 -n student-api
418+ ```
419+ - Now access API at: ** http://localhost:8080/api/v1/students **
420+
421+ - ** Testing in Kubernetes**
422+ ``` sh
423+ # Healthcheck endpoint
424+ curl http://< node-ip> :< nodePort> /healthcheck
425+ ```
426+ - Expected response:
427+ ``` json
428+ {"status" : " ok" }
429+ ```
430+
431+ - ** Cleanup**
432+ ``` sh
433+ kubectl delete -f k8s/application.yml
434+ kubectl delete -f k8s/database.yml
435+ kubectl delete -f k8s/vault.yml
436+ kubectl delete -f k8s/external-secrets.yml
437+ ```
438+
362439** At the end: "Our app is cloud-ready, secure, and scalable on Kubernetes".**
0 commit comments