kubernetes-sigs / aws-load-balancer-controller

A Kubernetes controller for Elastic Load Balancers
https://kubernetes-sigs.github.io/aws-load-balancer-controller/
Apache License 2.0
3.95k stars 1.47k forks source link

How does this chart create an ALB when there's no type: LoadBalancer defined option in kind: Service definition in the helm chart #2677

Closed hectoralicea closed 2 years ago

hectoralicea commented 2 years ago

Describe the bug Unable to get this helm chart to create an AWS ALB no matter what.

Steps to reproduce create helm using the below values file. following is output of services

hector$ kc get svc -A
NAMESPACE     NAME                                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)         AGE
cicd          jenkins                             ClusterIP   172.20.30.91     <none>        80/TCP          20m
cicd          jenkins-agent                       ClusterIP   172.20.13.53     <none>        50000/TCP       20m
default       kubernetes                          ClusterIP   172.20.0.1       <none>        443/TCP         30h
kube-system   aws-load-balancer-webhook-service   ClusterIP   172.20.229.184   <none>        443/TCP         25m
kube-system   external-dns                        ClusterIP   172.20.136.44    <none>        7979/TCP        25h
kube-system   kube-dns                            ClusterIP   172.20.0.10      <none>        53/UDP,53/TCP   30h

See!! All EXTERNAL-IP are blank, because the helm chart template for service does not have the type: LoadBalancer option

Expected outcome kubectl get service -n kube-system should list EXTERNAL-IP

Environment EKS 1.19

Additional Context: See following values file. it goes through ansible template to render it.

# Override values for aws-load-balancer-controller.

image:
  repository: {{ aws_load_balancer_controller_image }}

# The name of the Kubernetes cluster. A non-empty value is required
clusterName: {{ k8s_cluster_name}}

serviceAccount:
  # Specifies whether a service account should be created
  create: false

  # The name of the service account to use.
  name: aws-load-balancer-controller  # use the one auto created by eksctl

updateStrategy:
  type: RollingUpdate
  rollingUpdate:
    maxSurge: 1
    maxUnavailable: 1

# serviceAnnotations contains annotations to be added to the provisioned webhook service resource
serviceAnnotations:
  external-dns.alpha.kubernetes.io/hostname: {{ item.hostname }}
  service.beta.kubernetes.io/aws-load-balancer-scheme: internal
  service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: instance 
  service.beta.kubernetes.io/aws-load-balancer-type: nlb

# Enable cert-manager
enableCertManager: false

# The ingress class this controller will satisfy. If not specified, controller will match all
# ingresses without ingress class annotation and ingresses of type alb
ingressClass: alb
#ingressClass: {{ item.ingress_class }}

# The AWS region for the kubernetes cluster. Set to use KIAM or kube2iam for example.
region: {{ aws_region }}

# The VPC ID for the Kubernetes cluster. Set this manually when your pods are unable to use the metadata service to determine this automatically
vpcId: {{ vpc_id }}

# Set the controller log level - info(default), debug (default "info")
logLevel: info

# defaultTags are the tags to apply to all AWS resources managed by this controller
defaultTags:
  aws_environment_prefix: '{{ aws_environment_prefix }}'
  aws_environment_name: '{{ aws_environment_name }}'
  aws_vpc_name: '{{ aws_vpc_name }}'
  cluster_name: '{{ item.ingress_class }}'
  Ansible: "true"
M00nF1sh commented 2 years ago

@hectoralicea The controller helm chart itself is the infrastructure and don't create any ALBs, the aws-load-balancer-webhook-service is expected to be ClusterIP.

You need to create a Service/Ingress yourself, and the controller will then provision NLBs/ALBs for you.

hectoralicea commented 2 years ago

@hectoralicea The controller helm chart itself is the infrastructure and don't create any ALBs, the aws-load-balancer-webhook-service is expected to be ClusterIP.

You need to create a Service/Ingress yourself, and the controller will then provision NLBs/ALBs for you.

yea, it took me a few days to figure this out.

Still having issues but learning more each day.

kishorj commented 2 years ago

@hectoralicea, I'm closing the issue. If you have further concerns, feel free to reopen or create a new issue.