What are Services in K8s?
In Kubernetes, Services are objects that provide stable network identities to Pods and abstract away the details of Pod IP addresses. Services allow Pods to receive traffic from other Pods, Services, and external clients.
instead of the todo-app, I have chosen the vk-notes-app to complete this task.
Step 1: Create a Service YAML File (service.yml)
Step 2: Apply the Service Definition
kubectl apply -f service.yml -n <namespace-name>
Step 3: Verify the Service
minikube service notes-app-service -n <namespace-name>
Step 1: Update the ClusterIP Service YAML File (cluster-ip-service.yml)
Step 2: Apply the Updated ClusterIP Service Definition
kubectl apply -f cluster-ip-service.yml -n <namespace-name>
Step 3: create a simple test Pod
Step 4: Apply the test Pod YAML
kubectl apply -f test-pod.yml -n <namespace-name>
Step 5: Once the test Pod is running, you can use kubectl exec
to access it
kubectl exec -it test-pod -n <namespace-name> -- /bin/sh
Yes, it appears that we have successfully accessed the test Pod named "test-pod" within the "my-notes-app" namespace. we are now inside the test Pod, as indicated by the / #
prompt.
Step 1: Create a NodePort Service YAML File (load-balancer-service.yml)
Step 2: Apply the LoadBalancer Service Definition
Step 3: Verify the LoadBalancer Service
Thank you so much for reading
Follow me on LinkedIn to see interesting posts like this : )