K8s Services - philipf/notebook GitHub Wiki

Service uses selector to forward traffic to the selected pods

apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  type: ClusterIP
  selector:
    app: nginx
  ports:
  - protocol: TCP
    port: 8080
    targetPort: 80
kubectl get svc
kubectl get endpoints my-service