Kubernetes Services with YAML
Step-01: Introduction to Services¶
- We are going to look in to below two services in detail with a frotnend and backend example
- LoadBalancer Service
- ClusterIP Service
Step-02: Create Backend Deployment & Cluster IP Service¶
- Write the Deployment template for backend REST application.
- Write the Cluster IP service template for backend REST application.
- Important Notes:
- Name of Cluster IP service should be
name: my-backend-servicebecause same is configured in frontend nginx reverse proxydefault.conf. - Test with different name and understand the issue we face
- We have also discussed about in our Section-12
Step-03: Create Frontend Deployment & LoadBalancer Service¶
- Write the Deployment template for frontend Nginx Application
- Write the LoadBalancer service template for frontend Nginx Application
- Access REST Application
Step-04: Delete & Recreate Objects using kubectl apply¶
Delete Objects (file by file)¶
# Change Directory
cd kube-manifests/
# Delete Objects File by file
kubectl delete -f 01-backend-deployment.yml -f 02-backend-clusterip-service.yml -f 03-frontend-deployment.yml -f 04-frontend-LoadBalancer-service.yml
kubectl get all
Recreate Objects using YAML files in a folder¶
# Change Directory
cd 17-yaml-declarative-k8s-services/
# Recreate Objects by referencing a folder
kubectl apply -f kube-manifests/
kubectl get all
Delete Objects using YAML files in folder¶
# Change Directory
cd 17-yaml-declarative-k8s-services/
# Delete Objects by just referencing a folder
kubectl delete -f kube-manifests/
kubectl get all
Additional References - Use Label Selectors for get and delete¶
🎉 New Course
Ultimate DevOps Real-World Project Implementation on AWS
$15.99
$84.99
81% OFF
DEVOPS2026FEB
Enroll Now on Udemy
🎉 Offer