k8s Service类型区别
1. ClusterIP
Exposes the Service on a cluster-internal IP. This is the default ServiceType.
2. NodePort
ServiceType. When kubernetes creates a NodePort service, kube-proxy
allocates a port in the range 30000-32767 and opens this port on the eth0
interface of every node (the NodePort
). Connections to this port are then forwarded to the service’s cluster IP. A gateway router typically sits in front of the cluster and forwards packets to the node.
3.
Services of type LoadBalancer
have some limitations. They cannot do TLS termination, do virtual hosts or path-based routing, so you can’t use a single load balancer to proxy to multiple services. These limitations led to the addition in Kubernetes v1.2 of a separate kubernetes resource called Ingress
and Route
(on OpenShift).
4. ExternalName
Maps the Service to the contents of the externalName field (e.g. foo.bar.example.com), by returning a CNAME record.
You can also use Ingress
in addition to Service
to expose HTTP/HTTPS Services. Ingress however is technically not a ServiceType. It acts as the entry point for your cluster and lets you consolidate routing rules into a single resource.
- 点赞
- 收藏
- 关注作者
评论(0)