OpenShift Service Definition: Difference between revisions
Jump to navigation
Jump to search
(→port) |
(→port) |
||
Line 44: | Line 44: | ||
====port==== | ====port==== | ||
The port that will be exposed by this service. This is part of the service's address, and it should be used by the service's clients to connect to it. This is '''not''' the backend pod's port - though it can have the same value as the backend pod's port. | The port that will be exposed by this service. This is part of the service's address, and it should be used by the service's clients to connect to it. This is '''not''' the [[#targetPort|backend pod's port]] - though it can have the same value as the backend pod's port. | ||
====targetPort==== | |||
The backend pod's port. |
Revision as of 23:03, 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 service's 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'.
ports
The list of ports that are exposed by this service.
port
The port that will be exposed by this service. This is part of the service's address, and it should be used by the service's clients to connect to it. This is not the backend pod's port - though it can have the same value as the backend pod's port.
targetPort
The backend pod's port.