OpenShift Service Definition: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 19: Line 19:
   name: gogs
   name: gogs
  '''spec''':
  '''spec''':
  '''type''': <font color=SandyBrown>ClusterIP</font>
   ports:
   ports:
   - name: web
   - name: web
Line 28: Line 29:
     <font color=SandyBrown>pod_selector_label_name_2</font>: <font color=SandyBrown> pod_selector_value_2</font>
     <font color=SandyBrown>pod_selector_label_name_2</font>: <font color=SandyBrown> pod_selector_value_2</font>
   sessionAffinity: None
   sessionAffinity: None
  type: ClusterIP


=Elements=
=Elements=

Revision as of 22:54, 26 February 2018

External

Internal

Example

apiVersion: v1
kind: Service
metadata:
  annotations:
    description: The Gogs server's http port
  labels:
    app: gogs
  name: gogs
spec:
  type: ClusterIP
  ports:
  - name: web
    port: 3000
    protocol: TCP
    targetPort: 3000
  selector:
    pod_selector_label_name_1:  pod_selector_value_1
    pod_selector_label_name_2:  pod_selector_value_2
  sessionAffinity: None

Elements

spec

selector

If this selector is included in the definition, the EndpointsController associates this service with the endpoints of pods that match the selector. The labels are applied to pods by the deployment configuration 'spec.template.metadata.labels'.