In the training, we will learn about Services.
Navigate to the folder
11_service
from CLI, before you get started.
-
Inspect deployment.yaml definition file and create the pod
cat deployment.yaml kubectl create -f deployment.yaml
-
Inspect service-v1.yaml definition file and create the service
cat service-v1.yaml kubectl create -f service-v1.yaml
-
Take a look at the created endpoints and IPs of the pods
kubectl get po,ep -o wide
-
Scale the deployment
kubectl scale deployment my-deployment --replicas 3
-
Take a look at the created Endpoints and IPs of the pods
kubectl get po,ep -o wide
-
Port forward the service port 80 to the local port 8080
kubectl port-forward service/my-service 8080:80
-
You can now access the service (in a seperate terminal)
curl http://127.0.0.1:8080
- You can stop the port-forwarding process via
<CTRL>+<C>
-
Inspect service-v2.yaml definition file and apply the changes to the service
cat service-v2.yaml kubectl apply -f service-v2.yaml
-
Access the service
Get an EXTERNAL-IP of one of the nodes
kubectl get nodes -o wide
You can now access the service (or via web browser)
curl http://<EXTERNAL-IP>:30000
-
Inspect service-v3.yaml definition file and apply the changes to the service
cat service-v3.yaml kubectl apply -f service-v3.yaml
-
Access the service
Get an EXTERNAL-IP of the service
kubectl get svc
You can now access the service (or via web browser)
curl http://<EXTERNAL-IP>
- Delete the resources - deployment and service.
kubectl delete deploy my-deployment kubectl delete svc my-service