concept
Service types and ports
A Service supplies a stable access abstraction. port is the client-facing port; targetPort identifies the backend listener. Exposure depends on type and implementation.
Formal Syntax & Structure
kubernetes syntaxkubernetes
Service types and portsWorking Example
Example Snippetkubernetes
apiVersion: v1kind: Servicemetadata: name: api namespace: book-labspec: type: ClusterIP selector: app: api ports: - name: http protocol: TCP port: 80 targetPort: 8080