默认 kubernetes 服务的目的是什么? [英] What's the purpose of the default kubernetes service?
问题描述
当您运行:kubectl get svc -n default
时,您将拥有一个类型为 ClusterIP 的 kubernetes 服务.
When you run: kubectl get svc -n default
, you will have a kubernetes service with Type as ClusterIP already there.
这项服务的目的是什么?任何参考赞赏.
What is the purpose of this service? Any references appreciated.
我在 Minikube 中运行
I'm running in Minikube
xyz:Kubernetes _$ kubectl describe svc/kubernetes
Name: kubernetes
Namespace: default
Labels: component=apiserver
provider=kubernetes
Annotations: <none>
Selector: <none>
Type: ClusterIP
IP: 10.0.0.1
Port: https 443/TCP
TargetPort: 8443/TCP
Endpoints: 10.0.2.15:8443
Session Affinity: ClientIP
Events: <none>
xyz:Kubernetes _$ kubectl cluster-info
Kubernetes master is running at https://192.168.99.100:8443
推荐答案
AFAIK 默认命名空间中的 kubernetes 服务是将请求转发到 Kubernetes 主服务器(通常是 kubernetes API 服务器)的服务.
AFAIK the kubernetes service in the default namespace is a service which forwards requests to the Kubernetes master ( Typically kubernetes API server).
因此所有从集群到 kubernetes.default 服务的请求都将路由到配置的 Endpoint IP.在这种情况下它的 kubernetes 主 IP
So all the requests to the kubernetes.default service from the cluster will be routed to the configured Endpoint IP. In this scenario its the kubernetes master IP
例如
让我们检查 kubectl describe svc kubernetes
的输出并查看端点 IP.
Lets checkout the output of kubectl describe svc kubernetes
and look at the the Endpoint IP.
现在让我们检查我们的集群信息
Now lets check our cluster info
kubectl cluster-info
请注意,kubernetes master 运行在与 kubernetes.default 服务的 Endpoints IP 相同的 IP 上.
Please note that the kubernetes master is running at the same IP as the Endpoints IP of kubernetes.default service.
希望有帮助.
这篇关于默认 kubernetes 服务的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!