Day 34 : Working with Services in Kubernetes
Task-1:
- Create a Service for your todo-app Deployment from Day-32
- Create a Service definition for your todo-app Deployment in a YAML file.
- Apply the Service definition to your K8s (minikube) cluster using the `kubectl apply -f service.yml -n <namespace-name>` command.
- Verify that the Service is working by accessing the todo-app using the Service's IP and Port in your Namespace.
kubectl apply -f service.yml -n <namespace-name>
kubectl get svc -n <namespace>
minikube service <service_name> -n=<namespace> --url
curl -L <service-ip>:<service-port>
curl -L https://192.168.49.2:30080
Task-2:
- Create a ClusterIP Service for accessing the todo-app from within the cluster
- Create a ClusterIP Service definition for your todo-app Deployment in a YAML file.
- Apply the ClusterIP Service definition to your K8s (minikube) cluster using the `kubectl apply -f cluster-ip-service.yml -n <namespace-name>` command.
- Verify that the ClusterIP Service is working by accessing the todo-app from another Pod in the cluster in your Namespace.
kubectl get services -n <namespace>
kubectl get pods -n <namespace>
kubectl exec -it <pod-name> -n <namespace> -- bash
curl -L <cluster-ip>:<service-port>
curl -L 10.102.44.73:8000
Task-3:
- Create a LoadBalancer Service for accessing the todo-app from outside the cluster
- Create a LoadBalancer Service definition for your todo-app Deployment in a YAML file.
- Apply the LoadBalancer Service definition to your K8s (minikube) cluster using the `kubectl apply -f load-balancer-service.yml -n <namespace-name>` command.
- Verify that the LoadBalancer Service is working by accessing the todo-app from outside the cluster in your Namespace.
kubectl get services -n <namespace>
minikube service list
curl -L <load-balancer-ip>:<service-port>
curl -L https://192.168.49.2:30625
Service List:
Software Developer | Python | Django | Mysql | Devops
2 年This is my first Challenge and this is going to be make a more opportunity in my life Shubham Londhe thank you brother for making this type of Challenge and building a community for #devops #thankyou