首页 > 解决方案 > 大使服务保持“待定”

问题描述

目前在 Ubuntu Server 20 LTS 上运行一个全新的“多合一 VM”(堆叠的主/从方法)kubernetes v1.21.1-00,使用

还安装了 kubernetes-dashboard(但我想这对我的问题并不重要)。使用本指南安装大使:https ://www.getambassador.io/docs/edge-stack/latest/topics/install/yaml-install/我遇到了服务卡在“待定”状态的问题。

kubectl get svc -n ambassador打印出以下内容

NAME               TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
ambassador         LoadBalancer   10.97.117.249    <pending>     80:30925/TCP,443:32259/TCP   5h
ambassador-admin   ClusterIP      10.101.161.169   <none>        8877/TCP,8005/TCP            5h
ambassador-redis   ClusterIP      10.110.32.231    <none>        6379/TCP                     5h
quote              ClusterIP      10.104.150.137   <none>        80/TCP                       5h

虽然将服务中的typefromLoadBalancer更改为NodePort正确设置,但我不确定随之而来的影响。同样,我想在这里使用大使作为入口组件 - 使用我的设置(只有一台机器),可能不需要“真正的”负载平衡。

为了涵盖所有子域内容,我设置了一个通配符记录以指向我的机器,这意味着我有一个*.k8s.my-domain.com指向该主机的 CNAME。不知道,这种方法对于设置入口是否那么聪明。

编辑:事件列表,如下要求:

Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  116s  default-scheduler  Successfully assigned ambassador/ambassador-redis-584cd89b45-js5nw to dev-bvpl-099
  Normal  Pulled     116s  kubelet            Container image "redis:5.0.1" already present on machine
  Normal  Created    116s  kubelet            Created container redis
  Normal  Started    116s  kubelet            Started container redis

此外,这是 yaml 演示中待处理的服务(通过 导出kubectl get svc -n ambassador -o yaml ambassador

apiVersion: v1
kind: Service
metadata:
  annotations:
    a8r.io/bugs: https://github.com/datawire/ambassador/issues
    a8r.io/chat: http://a8r.io/Slack
    a8r.io/dependencies: ambassador-redis.ambassador
    a8r.io/description: The Ambassador Edge Stack goes beyond traditional API Gateways
      and Ingress Controllers with the advanced edge features needed to support developer
      self-service and full-cycle development.
    a8r.io/documentation: https://www.getambassador.io/docs/edge-stack/latest/
    a8r.io/owner: Ambassador Labs
    a8r.io/repository: github.com/datawire/ambassador
    a8r.io/support: https://www.getambassador.io/about-us/support/
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"a8r.io/bugs":"https://github.com/datawire/ambassador/issues","a8r.io/chat":"http://a8r.io/Slack","a8r.io/dependencies":"ambassador-redis.ambassador","a8r.io/description":"The Ambassador Edge Stack goes beyond traditional API Gateways and Ingress Controllers with the advanced edge features needed to support developer self-service and full-cycle development.","a8r.io/documentation":"https://www.getambassador.io/docs/edge-stack/latest/","a8r.io/owner":"Ambassador Labs","a8r.io/repository":"github.com/datawire/ambassador","a8r.io/support":"https://www.getambassador.io/about-us/support/"},"labels":{"app.kubernetes.io/component":"ambassador-service","product":"aes"},"name":"ambassador","namespace":"ambassador"},"spec":{"ports":[{"name":"http","port":80,"targetPort":8080},{"name":"https","port":443,"targetPort":8443}],"selector":{"service":"ambassador"},"type":"LoadBalancer"}}
  creationTimestamp: "2021-05-22T07:18:23Z"
  labels:
    app.kubernetes.io/component: ambassador-service
    product: aes
  name: ambassador
  namespace: ambassador
  resourceVersion: "4986406"
  uid: 68e4582c-be6d-460c-909e-dfc0ad84ae7a
spec:
  clusterIP: 10.107.194.191
  clusterIPs:
  - 10.107.194.191
  externalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: http
    nodePort: 32542
    port: 80
    protocol: TCP
    targetPort: 8080
  - name: https
    nodePort: 32420
    port: 443
    protocol: TCP
    targetPort: 8443
  selector:
    service: ambassador
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer: {}

编辑#2:我想知道https://stackoverflow.com/a/44112285/667183是否也适用于我的流程?

标签: kuberneteskubernetes-ingressambassador

解决方案


答案就在这里:https ://serverfault.com/questions/1064313/ambassador-service-stays-pending 。安装后load balancer整个设置工作。我决定使用metallbhttps://metallb.universe.tf/installation/#installation-by-manifest进行安装)。我决定为单节点 Kubernetes 集群使用以下配置:

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

几秒钟后,负载均衡器被检测到,一切正常。


推荐阅读