Kubernetes 将k8s群集设置为使用主机名/IP地址而不是本地主机
我刚刚安装了k8s群集,但是URL都使用localhost,并且希望将其更改为使用主机名甚至IP地址。因此,只能从主节点访问集群。我找不到合适的地方来做这个改变。非常感谢您的帮助Kubernetes 将k8s群集设置为使用主机名/IP地址而不是本地主机,kubernetes,
kubernetes,kubeadm,Kubernetes,
kubernetes,Kubeadm,我刚刚安装了k8s群集,但是URL都使用localhost,并且希望将其更改为使用主机名甚至IP地址。因此,只能从主节点访问集群。我找不到合适的地方来做这个改变。非常感谢您的帮助 OS: Redhat 7.1 Kubernetes version: 1.2 [rakeshk@ kubernetes]$ kubectl cluster-info Kubernetes master is running at http://localhost:8080 Elasticsearch is runni
OS: Redhat 7.1
Kubernetes version: 1.2
[rakeshk@ kubernetes]$ kubectl cluster-info
Kubernetes master is running at http://localhost:8080
Elasticsearch is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/elasticsearch-logging
Heapster is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/heapster
Kibana is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/kibana-logging
KubeDNS is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/kube-dns
kubedash is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/kubedash
kubernetes-dashboard is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard
Grafana is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana
InfluxDB is running at http://localhost:8080/api/v1/proxy/namespaces/kube-system/services/monitoring-influxdb
根据端口号(8080
,这是kube-apiserver
的默认值),我猜您正在运行kubectl-cluster-info
的同一台机器上运行kube-apiserver
命令
如果上述假设正确,则将/etc/kubernetes/admin.conf
文件(从运行kube-apiserver
的机器)复制到本地机器~/.kube/config
。在本地计算机上运行kubectl cluster info
(如果尚未在本地计算机上安装程序)。这将为您提供群集地址作为主机名或IP地址。它显示为IP地址还是主机名取决于IP地址的反向查找是否解析DNS记录
如果您正在使用程序初始化kubeadm init
将自动检测网络接口,以作为与默认网关的接口播发主机。如果默认网关IP地址不是可路由的IP地址,请确保将--api播发地址
设置为可路由的IP地址
您遵循了什么群集创建指南?已使用。在Redhat 7.1上运行kubernetes 1.2。您在库存文件中输入了什么?您是否为主机输入了机器名/ip地址,还是输入了“localhost”?这是一个多节点群集-已为包括主机在内的所有节点使用了主机名。您能否查看其中一个节点,并了解kubelet是如何配置为与主机通信的?由于它不在同一台主机上,因此必须将其配置为通过主机的主机名或IP到达主机<默认情况下,code>kubectl将始终在
localhost:8080
上查找主机,这就是它在主机上工作的原因。但是,您还应该能够在远程计算机上生成一个kubeconfig文件,该文件通过公开的安全端口到达主机。