Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

206
Vistas
How can I join a ALB ingress group instead of overriding an existing one in EKS?

I am deploying K8S to AWS EKS cluster and use ALB for the deployments. I'd like to use one ALB for multiple services but I can't figure out how to share the same ALB. Every time I deploy a ingress it will override an existing one.

I have two config yaml file:

a.yaml

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: sample-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/group.name: sample-ingress
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/group.order: '1'
spec:
  rules:
    - http:
        paths:
          - path: /sample-app/*
            backend:
              serviceName: sample-entrypoint
              servicePort: 80

b.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: sample-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/group.name: sample-ingress
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/group.order: '2'
spec:
  rules:
    - http:
        paths:
          - path: /sample-es/*
            backend:
              serviceName: sample-es-entrypoint
              servicePort: 9200

I'd like both share the same ALB so I specify the group name to be the same:

alb.ingress.kubernetes.io/group.name: sample-ingress

I also specify a different order in the two files.

but when I run kubectl apply -f a.yaml, It creates a ALB with the rule I specified in the config file: /sample-app/*. But when I run kubectl apply -f b.yaml, it overrides the existing rule with /sample-es/*. So how can I make both share the same ALB and allow them provide different rules?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

I guess you can create separate ingress and attach them to the same service configuration. Point the service configuration with alb, and that should work. I have a configuration for internal-facing services, please see if this works for you.

apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
  labels:
    app.kubernetes.io/instance: goldendev-ingress-test
    app.kubernetes.io/managed-by: Tiller
    app.kubernetes.io/name: ingress-test
    environment: DEV
    helm.sh/chart: ingress-test
  name: ingress-test
  namespace: default
spec:
  externalTrafficPolicy: Cluster
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 8080
  selector:
    app.kubernetes.io/instance: z1
    app.kubernetes.io/name: gunicorn
  sessionAffinity: None
  type: LoadBalancer

Ingress.yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: sample-ingress
  namespace: default
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/group.name: sample-ingress
    alb.ingress.kubernetes.io/scheme: internal
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/group.order: '1'
spec:
  rules:
    - http:
        paths:
          - path: /mappings/v1/hello/*
            backend:
              serviceName: ingress-test
              servicePort: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: sample-ingress-1
  namespace: default
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/group.name: sample-ingress
    alb.ingress.kubernetes.io/scheme: internal
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/group.order: '2'
spec:
  rules:
    - http:
        paths:
          - path: /mappings/v1/teams/*
            backend:
              serviceName: ingress-test-2
              servicePort: 80

I verified in the AWS console, it has created only 1 load balancer with service configuration. Ingress list:

 kubectl get ingress
NAME               HOSTS   ADDRESS   PORTS   AGE
sample-ingress     *                 80      19m
sample-ingress-1   *                 80      19m

Let me know if this helps.

over 4 years ago · Santiago Trujillo Denunciar

0

I have tried with hosts as below;

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: pub-uat-alb
  namespace: "uat-env"
  labels:
    imaharah-k8s/environment: staging
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: instance
    alb.ingress.kubernetes.io/tags: environment=staging
    alb.ingress.kubernetes.io/success-codes: '200,301,401'
    alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-1:123435678977:certificate/hskrhjf93ih-y4325kjhdsf0-hsr98
    alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-TLS-1-1-2017-01
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
    alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
spec:
  rules:
  - http:
      paths:
      - path: /*
        backend:
          serviceName: ssl-redirect
          servicePort: use-annotation

  - host: test1.test.com
    http:
      paths:
      - path: /*
        backend:
          serviceName: test1-service
          servicePort: 80

  - host: test2.test.com
    http:
      paths:
      - path: /*
        backend:
          serviceName: test2-service
          servicePort: 80

  - host: test3.test.com
    http:
      paths:
      - path: /*
        backend:
          serviceName: test3-service
          servicePort: 80

verify --->

[centos@ip-10-0-68-81 pub]$ kubectl get ingress -n uat-env --kubeconfig=$dev
NAME          CLASS    HOSTS                                          ADDRESS                                                                         PORTS   AGE
pub-uat-alb   <none>   test1.test.com,test2.test.com,test3.test.com   test-uatenv-testtest-gfsadasd76-94238798.us-east-1.elb.amazonaws.com            80      3d6h
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda