在kubernetes中,我无法访问由MetalLB Loadbalancer分配的externalIP

问题描述

首先,我在内部使用kubernetes建立集群。
https://metallb.universe.tf/installation/所示,我按照以下步骤安装了MetalLB,并配置了configmap,部署和服务。

import pandas as pd
import datetime as dt

def getConsecutiveIndexes(series,minimumLength=2,maximumDelta=1):
    """
    Return indexes based on Timedeltas's days value consecutively being within a threshold and of a minimum length.

    :param pd.Series series: Sorted series containing Timedeltas.
    :param minimumLength: Minimum length of list to be returned.
    :param maximumDelta: Maximum difference to be considered consecutive.
    """
    indexes = []
    previousValue = None
    for i,timedelta in series.items():
        val = timedelta.days
        previousValueDelta = 0 if previousValue is None else val - previousValue
        isConsecutive = previousValueDelta <= maximumDelta
        lastIndex = i == len(series) - 1
        
        if isConsecutive or not indexes:
            indexes.append(i)

        satisfiedLength = len(indexes) >= minimumLength
        
        if (lastIndex or not isConsecutive) and satisfiedLength:
            return indexes

        if not isConsecutive:
            indexes = [i]

        previousValue = val

def createTimedeltaSeries(l):
    """Easily create a series containing Timedeltas."""
    return pd.Series([dt.timedelta(days=value) for value in l])

assert [0,1,2,3,4,5,6,7] == getConsecutiveIndexes(createTimedeltaSeries([0,7,9]))
assert [1,2]                   == getConsecutiveIndexes(createTimedeltaSeries([2,10]))
assert [0,3]             == getConsecutiveIndexes(createTimedeltaSeries([2,10]),maximumDelta=2)
assert [2,4]                == getConsecutiveIndexes(createTimedeltaSeries([1,6]),minimumLength=3)

configmap.yaml

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/metallb.yaml
# On first install only
kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"

tutorial.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 192.168.1.240-192.168.1.250

配置后,当我使用命令apiVersion: apps/v1 kind: Deployment metadata: name: nginx spec: selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1 ports: - name: http containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: nginx spec: ports: - name: http port: 80 protocol: TCP targetPort: 80 selector: app: nginx type: LoadBalancer 检查服务时,有一个带有EXTERNAL-IP的Nginx服务。

kubectl get svc

当我输入“ 192.168.143.230”时,我无法访问该页面,并显示以下消息:“无法访问192.168.143.230,此站点花费了很长时间才能响应”。
如何使用EXTERNAL-IP访问该页面?

解决方法

我想它将可以通过192.168.143.230:32190访问

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...