Kubernetes Service Manifest: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 18: Line 18:
   [[#type|type]]: ClusterIP
   [[#type|type]]: ClusterIP
   selector:
   selector:
     app: blue # Label selector, the service is looking for pods with the label "app=blue"
     function: front-end # Label selector, the service is looking for pods with the label "function=front-end"
   ports:
   ports:
   - port: 8080
   - port: 8080

Revision as of 21:55, 19 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: 8080
    targetPort: 
    protocol: TP

.spec Elements

type

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

publishNotReadyAddresses