Kubernetes Service Manifest: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 24: Line 24:
     targetPort: 8080
     targetPort: 8080
     protocol: TP
     protocol: TP
=.metadata Elements=
==labels==
The labels declared here apply to the service instance itself, they have no relationship to the target pods' labels, which are declared in the spec [[#selector|selector]].


=.spec Elements=
=.spec Elements=
Line 29: Line 33:


Optional element. If not specified, it is assumed to be "[[Kubernetes Service Concepts#ClusterIP_Service|ClusterIP]]".
Optional element. If not specified, it is assumed to be "[[Kubernetes Service Concepts#ClusterIP_Service|ClusterIP]]".
 
==selector==
==publishNotReadyAddresses==
==publishNotReadyAddresses==

Revision as of 00:27, 20 September 2020

External

Internal

Example

apiVersion: v1
kind: Service
metadata:
  name: blue
  labels:
    size: large
spec:
  type: ClusterIP
  selector:
    function: front-end # Label selector, the service is looking for
                        # pods with the label "function=front-end"
  ports:
  - port: 80
    targetPort: 8080
    protocol: TP

.metadata Elements

labels

The labels declared here apply to the service instance itself, they have no relationship to the target pods' labels, which are declared in the spec selector.

.spec Elements

type

Optional element. If not specified, it is assumed to be "ClusterIP".

selector

publishNotReadyAddresses