What are services in Kubernetes?
The service supports access to a set of network Pods in Kubernetes.
The service selects the Pod based on the label. When making a network request to the service, it will select all Pods that match the service selector, select one of them, and forward the network request to it.
Kubernetes Service and Deployment
What is the difference between service and deployment in Kubernetes?
The deployment is responsible for keeping a pod in operation.
The service is responsible for enabling network access to a group of pods.
We can use deployment without services to keep the same Pod running in a cluster in Kubernetes. Development can be extended and expanded, Pod. Each Pod is accessed individually through direct network requests (rather than copying them to the service), but many pods are tracked.
We can also use services that have not been created. We need to create each pod separately (instead of creating a "body" like creation). Then our service can tag the network request tags to these pods by selecting them.
Service and development are different, but they can work well together
Kubernetes service NodePort example YAML
This sample YAML creates a service that can be used for external network requests. We have specified the NodePort to assign the service to that port on the value center node
Below is some sample YAML code to show you how to use the NodePort service in Kubernetes
Post comment 取消回复