Part 3 Flashcards
Service
- Create a deployment named
kplabs-service
- The deployment should have three replicas and the image should be based on
nginx
- Create a service based on NodePort.
- The service port should be 8080.
- Verify if you are able to see the index.html of Nginx from service port.
kubectl run kplabs-service –image=nginx –replicas 3
kubectl expose deployment kplabs-service –port=8080 –target-port=80 –type=NodePort
Service and Endpoints
- Create a deployment named
deployment-manual
Launch 3 replicas of nginx
image. Create a service named service-manual.
Create an endpoint with the IP address of all the pods of deployment-manual
and associate it with service-manual
.
Verify the endpoints of the service to check if IP addresses have been populated.
Load Balanacer Service
- Create a deployment named
kplabs-dmz
- There should be two replicas of
nginx
image as part of the deployment. - Create a service name
service-elb
and it should be based on LoadBalancer type. - The Load Balancer should list on Port 80.
- Once launched, verify that the nginx default page load when you open the Load Balancer IP in browser.
kubectl run deployment-manual –image=nginx –replicas 3
kubectl expose deployment deployment-manual –name=service-elb –port=80 –type=LoadBalancer
minikube service service-elb
Single Service Ingress
- Create a pod named
single-pod
. Expose Port 80.
2, Create service named single-service
. The service should listen on port of 8080
. It should direct traffic to single-pod
- Create an ingress named
single-ingress
. Ingress should have following specification:
i) Should direct all the traffic to single-service on the service port of 8080 - Verify if the ingress is created.
- Describe all the ingress rules.
- Does the ingress have any IP address on “ADDRESS” field? If not, find out what can be the reason behind it?
- Create an ingress which satisfies following requirement:
- example.com –| Requests Redirects to | service1:8085
- |
- test.com –| Requests Redirects to | service2:8089
- Other Requests -| Requests Redirects to | service3:9005
- All the pods should be based on
nginx
image.
Question 6: Namespaces
- Create a namespace named
kplabs-namespace
- Launch a POD from
nginx
image. Expose Port8080
. Pod should be in kplabs-namespace - Verify the status of the pod with kubectl command.
kubectl create namespace kplabs-namespace
kubectl run kplabs-namespace-pod –image=nginx -n kplabs-namespace –restart=Never
kubectl get pods -n kplabs-namespace
kubectl expose pod kplabs-namespace-pod –type=NodePort –name=nginx-service -n kplabs-namespace –port 8080