首页 > 解决方案 > 使用守护程序集的 k3s 进入我的应用程序的服务路由不起作用

问题描述

我的 k3s 集群与 Grafana 监控和 traefik/klipper-lb 配合得很好。但是我自己的应用程序 Ingress 不起作用。

入口.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-esp
  namespace: myapp
spec:
  rules:
  - host: test-esp.nip.io
    http:
      paths:
      - path: /
        backend:
          serviceName: test-esp
          servicePort: http

服务.yaml

apiVersion: v1
kind: Service
metadata:
  labels:
    app: test-esp
  name: test-esp
  namespace: myapp
spec:
  ports:
  - name: http
    port: 22000
    targetPort: 22000
  selector:
    app: test-esp

守护进程.yaml

apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    app: test-esp
  name: test-esp
  namespace: myapp
spec:
  selector:
    matchLabels:
      app: test-esp
  template:
    metadata:
      labels:
        app: test-esp
    spec:
      tolerations:
      - key: node-role.kubernetes.io/master
        effect: NoSchedule
      containers:
      - name: test-esp
        image: <gitlab image pull url>
        envFrom:
        - configMapRef:
            name: test-esp-config
        ports:
        - containerPort: 22000
        command: ["/home/scripts/entrypoint.sh"]
        args: ["1"]
        imagePullPolicy: Always
        resources: {}

** K3s 中的 3 个节点运行着 DaemonSet Pod **

> kubectl get po -n myapp
NAME                    READY   STATUS    RESTARTS   AGE
test-esp-9cwzp   1/1     Running   0          4m3s
test-esp-qjk5n   1/1     Running   0          4m3s
test-esp-j8nnk   1/1     Running   0          4m3s

** 单个节点上的 curl 工作 **

masternode-1> curl -XGET http://masterip:22000  
<long html page>

**入口卷曲超时**

mylocal> curl -XGET http://test-esp.nip.io
gateway timeout

** ping/telnet 到 test-esp.nip.io 发现 ip 运行良好 **

那里有任何专家,这与 iptables 有关吗?

标签: networkingkuberneteskubernetes-ingressk3s

解决方案


推荐阅读