Created
March 20, 2019 20:19
-
-
Save ypan887/07268069d8b2ff9d75fbf3e1be2a1c65 to your computer and use it in GitHub Desktop.
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
kind: Service # When service objects is created it will be assigned an internal cluster ip | |
apiVersion: v1 | |
metadata: | |
name: my-service # When a service with selector is crated, an Endpoints object with the same name is | |
spec: # also created. Endpoints is a collection of endpoints that implement the actual | |
selector: # service. It is updated when service are added/removed | |
app: MyApp # Selectors to identify the backing pods | |
env: Pord | |
ports: | |
- protocol: TCP # Default potocal is TCP | |
port: 80 # Listen on port 80 | |
targetPort: 9376 # Forward traffice to each selected pod at port 9376. Default to the same | |
# port as port field above. Can be a string that reference the port on pod | |
============================= | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: my-service # Service can be created withou selectors, no endpoint is created | |
spec: | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 9376 | |
------------------------------- | |
kind: Endpoints # You can manaully create the endpoint object and point the service | |
apiVersion: v1 # to any ip address you like. Useful when you want to guide traffic | |
metadata: # to resources under a different namespace or outside of the current | |
name: my-service # cluster ( another cluster or not on k8s at all ). | |
subsets: | |
- addresses: | |
- ip: 1.2.3.4 | |
ports: | |
- port: 9376 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment