Created
August 27, 2023 19:05
-
-
Save aojea/ce7b08fe9e9d57125ccc6a9728a414b6 to your computer and use it in GitHub Desktop.
Service selector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: job1 | |
labels: | |
job-name: "job1" | |
job-index: "0" | |
spec: | |
hostNetwork: true | |
containers: | |
- name: job1 | |
image: httpd:2 | |
--- | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: job2 | |
labels: | |
job-name: "job2" | |
job-index: "0" | |
spec: | |
hostNetwork: true | |
containers: | |
- name: job2 | |
image: httpd:2 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: service-good | |
spec: | |
selector: | |
job-name: "job1" | |
job-index: "0" | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 9376 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: service-wrong | |
spec: | |
selector: | |
job-index: "0" | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 9376 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When applying the manifest, we can observe that the
service-wrong
gets the endpoints from both pods