我想使用Microk8s来玩 Spring Cloud Data Flow,所以我在我的 Windows 10 上安装了 Multipass,并在虚拟机中运行安装了 Microk8s 的 Ubuntu。我想实现这一点,所有容器都在 Ubuntu 上运行,这是一个由 Multipass 管理的无头 Virtualbox VM,但我希望能够从 Windows 连接到容器。
拓扑如下所示:
视窗 10:
- 我家路由器提供的192.168.1.107
在 Virtualbox 中运行的Ubuntu
- 我相信 192.168.52.1 由 Windows for Virtualbox 提供(Virtualbox Host-Only Network)
如果我登录 Ubuntuifconfig
会说以下内容:
multipass@scdf:~/scdf/spring-cloud-dataflow$ ifconfig
cbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.1.1 netmask 255.255.255.0 broadcast 0.0.0.0
inet6 fe80::c802:9fff:fea2:93f1 prefixlen 64 scopeid 0x20<link>
ether ca:02:9f:a2:93:f1 txqueuelen 1000 (Ethernet)
RX packets 19890 bytes 6628126 (6.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 21413 bytes 13988665 (13.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::a00:27ff:feba:30bb prefixlen 64 scopeid 0x20<link>
ether 08:00:27:ba:30:bb txqueuelen 1000 (Ethernet)
RX packets 208972 bytes 273941063 (273.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 24249 bytes 2084939 (2.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 157483 bytes 40950239 (40.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 157483 bytes 40950239 (40.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
microk8s.kubectl get all
说如下,它已在 Ubuntu 中执行:
multipass@scdf:~/scdf/spring-cloud-dataflow$ microk8s.kubectl get all
NAME READY STATUS RESTARTS AGE
pod/default-http-backend-5d5ff5d4f5-6ttvd 1/1 Running 1 29m
pod/kafka-broker-64445d8596-88rl6 1/1 Running 24 98m
pod/kafka-zk-77bdb5bcbb-qjxfh 1/1 Running 4 98m
pod/mysql-bdd598966-nknwk 0/1 Pending 0 87m
pod/nginx-ingress-microk8s-controller-dh28n 1/1 Running 1 29m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/default-http-backend ClusterIP 10.152.183.57 <none> 80/TCP 29m
service/kafka ClusterIP 10.152.183.194 <none> 9092/TCP 98m
service/kafka-zk ClusterIP 10.152.183.80 <none> 2181/TCP,2888/TCP,3888/TCP 98m
service/kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 100m
service/mysql ClusterIP 10.152.183.113 <none> 3306/TCP 87m
service/scdf-server LoadBalancer 10.152.183.122 <pending> 80:32548/TCP 80m
service/skipper LoadBalancer 10.152.183.163 <pending> 80:30955/TCP 81m
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
daemonset.apps/nginx-ingress-microk8s-controller 1 1 1 1 1 <none> 29m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/default-http-backend 1/1 1 1 29m
deployment.apps/kafka-broker 1/1 1 1 98m
deployment.apps/kafka-zk 1/1 1 1 98m
deployment.apps/mysql 0/1 1 0 87m
deployment.apps/scdf-server 0/1 0 0 80m
deployment.apps/skipper 0/1 0 0 82m
NAME DESIRED CURRENT READY AGE
replicaset.apps/default-http-backend-5d5ff5d4f5 1 1 1 29m
replicaset.apps/kafka-broker-64445d8596 1 1 1 98m
replicaset.apps/kafka-zk-77bdb5bcbb 1 1 1 98m
replicaset.apps/mysql-bdd598966 1 1 0 87m
replicaset.apps/scdf-server-6988d7795f 1 0 0 80m
replicaset.apps/skipper-5957946bf5 1 0 0 82m
如您所见<Pending>
,外部 IP 地址有两种状态。我相信那些应该被暴露以便能够连接到。
我做了我在此帮助中找到的内容,但我无法得知服务器获取外部 IP。
我在这里做错了什么?Microk8s 能够暴露它的容器吗?