我在 Ubuntu 服务器上运行 microk8s 实例作为香草安装,使用 MetalLB 配置以动态分配 10.0.2.1 到 10.0.2.200 并启用 Nginx 入口控制器。我已使用以下命令在此实例( https://github.com/bitnami/charts/tree/master/bitnami/wordpress/#installing-the-chart )上安装了 wordpress helm 图表:
helm install wordpress \
--set wordpressUsername=admin \
--set wordpressPassword=password \
--set mariadb.mariadbRootPassword=secretpassword \
--set ingress.enabled=true \
--set ingress.hostname=wordpress.internal \
bitnami/wordpress
服务启动并成功运行,当我运行时
kubectl describe services wordpress
我得到以下信息:
Name: wordpress
Namespace: default
Labels: app.kubernetes.io/instance=wordpress
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=wordpress
helm.sh/chart=wordpress-9.3.10
Annotations: meta.helm.sh/release-name: wordpress
meta.helm.sh/release-namespace: default
Selector: app.kubernetes.io/instance=wordpress,app.kubernetes.io/name=wordpress
Type: LoadBalancer
IP: 10.152.183.73
LoadBalancer Ingress: 10.0.2.1
Port: http 80/TCP
TargetPort: http/TCP
NodePort: http 31799/TCP
Endpoints: 10.1.70.14:8080
Port: https 443/TCP
TargetPort: https/TCP
NodePort: https 30087/TCP
Endpoints: 10.1.70.14:8443
Session Affinity: None
External Traffic Policy: Cluster
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal IPAllocated 32m metallb-controller Assigned IP "10.0.2.1"
Normal nodeAssigned 6m41s (x3 over 31m) metallb-speaker announcing from node "k8s"
当我通过 SSH 连接到安装了 microk8s 的节点时,实例会按照我的预期响应:
curl 10.0.2.1
<!DOCTYPE html>
<html class="no-js" lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" >
<link rel="profile" href="https://gmpg.org/xfn/11">
<title>User's Blog! – Just another WordPress site</title>
但是,当我在联网的 Macbook 上运行相同的命令时,我无法得到响应:
curl 10.0.2.1
curl: (7) Failed to connect to 10.0.2.1 port 80: Operation timed out