Kubernetes Services are a great way to combine Kubernetes networking with the dynamic and often automated nature of Kubernetes applications. In this lab, you will use Services to expose existing Kubernetes Pods. This will allow you to practice your skills with Kubernetes Services.
Expose the Pods f as an Internal Service
apiVersion: v1
kind: Service
metadata:
name: user-db-svc
spec:
type: ClusterIP
selector:
app: user-db
ports:
- protocol: TCP
port: 80
targetPort: 80
Expose the Pods as an External Service
apiVersion: v1
kind: Service
metadata:
name: web-frontend-svc
spec:
type: NodePort
selector:
app: web-frontend
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 30080