OpenShift Service Definition: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 36: Line 36:
===selector===
===selector===


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

Revision as of 08:41, 9 December 2017

External

Internal

Example

apiVersion: v1
kind: Service
metadata:
  annotations:
    description: The Gogs server's http port
  labels:
    app: gogs
  name: gogs
spec:
  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
  type: ClusterIP

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'.