Hands-on task
ClusterIP Service
The Kubernetes cluster in this sandbox (kubectl is already configured) runs a Deployment web: its pods serve a page on port 8080. Next to it is a Deployment client for making requests from inside the cluster. Give the web pods a stable address: prepare in /root/svc.yaml a Service of type ClusterIP named web that listens on port 80 and forwards to targetPort 8080. You don't have to write it by hand — it's easier to generate it with a kubectl command using --dry-run=client -o yaml. Look at the result in the Editor tab and apply it to the cluster: a request from client to http://web must return the page.
- service
- clusterip
- kubectl
- port and targetPort
- dry-run
- kubectl apply
- endpoints