我已经设置了一个在 2 个 vagrant VM(均为 Ubuntu 22.04)上运行的 microk8s(1.26)集群,我还启用了 minio 插件。
设置顺利,使用sudo microk8s kubectl-minio proxy
,我能够从主机加载 minio 操作员控制台。但是,我认为它没有完全正常工作,我无法访问管理控制台,也没有获得存储桶列表。
我猜想集群中还需要暴露其他东西,但我不确定暴露什么以及如何暴露。我设法mc
只从虚拟机中使用,而不是从主机中使用。
我希望能够让控制台完全正常工作,甚至能够从主机与 Minio API 进行交互。
是否可以?
只是为了向你展示情况:
microk8s kubectl get all --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system pod/hostpath-provisioner-69cd9ff5b8-xc9jq 1/1 Running 1 (27m ago) 23h
kube-system pod/kubernetes-dashboard-dc96f9fc-t8r5z 1/1 Running 1 (27m ago) 23h
kube-system pod/calico-kube-controllers-7657549d9-nn765 1/1 Running 1 (27m ago) 24h
kube-system pod/calico-node-xfbsn 1/1 Running 1 (27m ago) 24h
kube-system pod/dashboard-metrics-scraper-7bc864c59-2c4mt 1/1 Running 1 (25m ago) 23h
minio-operator pod/console-66c4b79fbd-fsgkt 1/1 Running 1 (25m ago) 23h
minio-operator pod/minio-operator-67dcf6dd7c-rv9cn 1/1 Running 1 (25m ago) 23h
kube-system pod/coredns-6f5f9b5d74-q6lxq 1/1 Running 1 (25m ago) 23h
kube-system pod/calico-node-vhlrq 1/1 Running 1 (25m ago) 24h
kube-system pod/metrics-server-6f754f88d-snwgh 1/1 Running 1 (25m ago) 23h
minio-operator pod/minio-operator-67dcf6dd7c-89pcc 1/1 Running 5 (25m ago) 23h
minio-operator pod/microk8s-ss-0-0 1/1 Running 5 (24m ago) 23h
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default service/kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 24h
kube-system service/metrics-server ClusterIP 10.152.183.116 <none> 443/TCP 23h
kube-system service/kubernetes-dashboard ClusterIP 10.152.183.52 <none> 443/TCP 23h
kube-system service/dashboard-metrics-scraper ClusterIP 10.152.183.129 <none> 8000/TCP 23h
kube-system service/kube-dns ClusterIP 10.152.183.10 <none> 53/UDP,53/TCP,9153/TCP 23h
minio-operator service/operator ClusterIP 10.152.183.170 <none> 4222/TCP,4221/TCP 23h
minio-operator service/console ClusterIP 10.152.183.101 <none> 9090/TCP,9443/TCP 23h
minio-operator service/minio ClusterIP 10.152.183.254 <none> 80/TCP 23h
minio-operator service/microk8s-console ClusterIP 10.152.183.130 <none> 9090/TCP 23h
minio-operator service/microk8s-hl ClusterIP None <none> 9000/TCP 23h
NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
kube-system daemonset.apps/calico-node 2 2 2 2 2 kubernetes.io/os=linux 24h
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE
kube-system deployment.apps/calico-kube-controllers 1/1 1 1 24h
kube-system deployment.apps/kubernetes-dashboard 1/1 1 1 23h
kube-system deployment.apps/hostpath-provisioner 1/1 1 1 23h
kube-system deployment.apps/dashboard-metrics-scraper 1/1 1 1 23h
minio-operator deployment.apps/console 1/1 1 1 23h
kube-system deployment.apps/coredns 1/1 1 1 23h
kube-system deployment.apps/metrics-server 1/1 1 1 23h
minio-operator deployment.apps/minio-operator 2/2 2 2 23h
NAMESPACE NAME DESIRED CURRENT READY AGE
kube-system replicaset.apps/calico-kube-controllers-79568db7f8 0 0 0 24h
kube-system replicaset.apps/calico-kube-controllers-7657549d9 1 1 1 24h
kube-system replicaset.apps/kubernetes-dashboard-dc96f9fc 1 1 1 23h
kube-system replicaset.apps/hostpath-provisioner-69cd9ff5b8 1 1 1 23h
kube-system replicaset.apps/dashboard-metrics-scraper-7bc864c59 1 1 1 23h
minio-operator replicaset.apps/console-66c4b79fbd 1 1 1 23h
kube-system replicaset.apps/coredns-6f5f9b5d74 1 1 1 23h
kube-system replicaset.apps/metrics-server-6f754f88d 1 1 1 23h
minio-operator replicaset.apps/minio-operator-67dcf6dd7c 2 2 2 23h
NAMESPACE NAME READY AGE
minio-operator statefulset.apps/microk8s-ss-0 1/1 23h
和:
microk8s kubectl get endpoints -A
NAMESPACE NAME ENDPOINTS AGE
default kubernetes 10.0.2.15:16443 24h
kube-system kubernetes-dashboard 10.1.146.205:8443 23h
kube-system dashboard-metrics-scraper 10.1.96.201:8000 23h
minio-operator console 10.1.96.203:9443,10.1.96.203:9090 23h
kube-system kube-dns 10.1.96.200:53,10.1.96.200:53,10.1.96.200:9153 23h
kube-system metrics-server 10.1.96.202:4443 23h
minio-operator operator 10.1.146.204:4222,10.1.146.204:4221 23h
minio-operator microk8s-hl 10.1.146.206:9000 23h
minio-operator microk8s-console 10.1.146.206:9090 23h
minio-operator minio 10.1.146.206:9000 23h
kube-system microk8s.io-hostpath <none> 23h
答案1
您是否在操作员控制台中创建了任何租户?创建租户后,您就可以访问管理控制台,您可以在其中创建存储桶、用户、IAM 策略等。
虚拟机可以正常工作,而主机无法正常工作的原因是服务正在监听 ClusterIP。为了将其暴露给主机,您可以执行以下两项操作之一
- 您可以通过公开服务
kubectl port-forward
,然后从主机使用您公开的端口进行访问。 - 或者您可以更改配置以监听 NodePort 而不是 ClusterIP,尽管这可能会产生其他意想不到的副作用。
- 您可以通过公开服务