本文介绍了默认的kubernetes服务的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行: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服务的所有请求都将被路由到配置的端点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主服务器与kubernetes.default服务的端点IP使用相同的IP.

Please note that the kubernetes master is running at the same IP as the Endpoints IP of kubernetes.default service.

希望有帮助.

这篇关于默认的kubernetes服务的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 21:39