首页 > 解决方案 > metallb提供的IP不可访问

问题描述

我有一个带有金属 LB 的裸机 Kubernetes 集群。我已将 GCP 外部负载均衡器用于分配给 Metallb 的 IP。Metallb 已将该 IP 分配给服务,但我仍然无法从集群外部访问该 IP 上的服务。

   apiVersion: v1
        kind: Service
        metadata:
          name: nginxlb
        spec:
          type: LoadBalancer
          selector:
            app: nginx
          ports:
          - name: http
            port: 80
            targetPort: 80
            protocol: TCP
    
    
    
  apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: nginx-deployment
    spec:
      selector:
        matchLabels:
          app: nginx
      replicas: 2
      template:
        metadata:
          labels:
            app: nginx
        spec:
          containers:
          - name: nginx
            image: nginx:latest
            ports:
            - containerPort: 80
    
    apiVersion: v1
    kind: ConfigMap
    metadata:
      namespace: metallb-system
      name: config
    data:
      config: |
        address-pools:
        - name: default
          protocol: layer2
          addresses:
          - 34.149.177.23-34.149.177.23

标签: kubernetesmetallb

解决方案


推荐阅读