[英]Expose microk8s services to vbox's vhost machine
Installed microk8s
on VirtualBox guest with fresh Ubuntu-Server.使用新的 Ubuntu-Server 在 VirtualBox 来宾上安装
microk8s
。 Exposed the kube.netes dahsboard through VirtualBox Port Forwarding but cannot connect from the VirtualBox's host machine.通过 VirtualBox 端口转发公开了 kube.netes 仪表板,但无法从 VirtualBox 的主机连接。 Service address (last):
服务地址(最后):
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 11h
kube-system service/kube-dns ClusterIP 10.152.183.10 <none> 53/UDP,53/TCP,9153/TCP 10h
kube-system service/metrics-server ClusterIP 10.152.183.103 <none> 443/TCP 10h
kube-system service/kubernetes-dashboard ClusterIP 10.152.183.162 <none> 443/TCP 10h
From the host dashboard is inaccessible:从主机仪表板无法访问:
light@brahmand:~$ curl -vks https://127.0.1.1:7071
* Trying 127.0.1.1:7071...
* TCP_NODELAY set
* Connected to 127.0.1.1 (127.0.1.1) port 7071 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* OpenSSL SSL_connect: Connection reset by peer in connection to 127.0.1.1:7071
* Closing connection 0
However, from the guest dashboard is accessible:但是,可以从访客仪表板访问:
root@siddhalok:/home/light# curl -k https://10.152.183.162:443
<!--...
--><!DOCTYPE html><html lang="en" dir="ltr"><head>
<meta charset="utf-8">
...
Firewall(s) is disabled:防火墙被禁用:
root@siddhalok:/home/light# systemctl status ufw
● ufw.service - Uncomplicated firewall
Loaded: loaded (/lib/systemd/system/ufw.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:ufw(8)
Jan 22 04:49:17 siddhalok systemd[1]: Stopping Uncomplicated firewall...
Jan 22 04:49:17 siddhalok ufw-init[16758]: Skip stopping firewall: ufw (not enabled)
Jan 22 04:49:17 siddhalok systemd[1]: ufw.service: Succeeded.
Jan 22 04:49:17 siddhalok systemd[1]: Stopped Uncomplicated firewall.
root@siddhalok:/home/light# systemctl status firewalld
Unit firewalld.service could not be found.
Note, the other 2 ports are being forwarded fine, SSH to guest is working.请注意,其他 2 个端口正在正常转发,SSH 到访客正在工作。
kubectl port-forward is a feature of Kube.netes. kubectl port-forward 是 Kube.netes 的一个特性。 It is not the port-forwarding from the Virtualbox ip. A Kube.netes nodes have an Ipaddress, this should be in your case the VM where you have running Kube.netes.
它不是来自 Virtualbox ip 的端口转发。Kube.netes 节点有一个 Ipaddress,在您的情况下,这应该是您运行 Kube.netes 的 VM。 Inside the node Kube.netes creates it own Network on which the Pods run.
在节点内,Kube.netes 创建自己的网络,Pod 运行在该网络上。 This are the clusterIps.
这是 clusterIps。 Those you camt access directly.
那些你不能直接访问的。
You have 3 choices你有3个选择
This is good for Testing.这有利于测试。
kubectl get node
gives you the list of your nodes给你你的节点列表
kubectl describe node "nodeName"
Inside the respose you can find the Ip on which the node is running.在 respose 中,您可以找到运行该节点的 Ip。
Ping it to be sure you do not have Network issues. Ping 以确保您没有网络问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.