Answer a question

enter image description here

I already deploy a treafik(v2.0) in the kubernetes(v1.15.2) kube-system namespace,now I define a custom namespace and deploy my microservice apps. Because the treafik could not share pods cross namespace,so I deploy a same treafik in dabai-fat namespace.Now the treafik ingress give me this tips:

0/3 nodes are available: 1 node(s) didn't have free ports for the requested pod ports, 2 node(s) didn't match node selector.

I think the same ingress node share a same 80 and 443 port and make conflict.What is the best practice to handle this problem? Now I want to mapping the microservice config center eureka to the internet.this is my route config:

  apiVersion: traefik.containo.us/v1alpha1
    kind: IngressRoute
    metadata:
      name: fat-eureka-route
    spec:
      entryPoints:
        - web
      routes:
        - match: Host(`k8s-fat-eureka.example.com`) 
          kind: Rule
          services:
            - name: eureka
              port: 8761

Answers

You don't need to deploy multiple ingress controllers in a cluster. Ingress controller deployed in a namespace should be able to work across the cluster for all pods across all namespace. Ingress controller generally have clusteroles which permits it to access ingress, services. endpoints across the cluster for all namespaces.

You just need to create an ingress resource in the namespace where you have the pod and service for eureka. Once you do that traefik ingress controller will watch that ingress is created and will configure traefik to route traffic to your pod via ingress.

Now traefik supports kubernetes native ingress and ingressroute via CRD. If you are using ingressroute make sure you have installed it with CRDs as specified in the docs

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐