Kubernetes Dashboard behind AWS ELB or internal LB

7/9/2018

I have deployed K8s dashboard via kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml.

And I can connect to the dashboard by running kubectl proxy.

My question is how can I expose this dashboard via internal LB or ELB?

I have changed the kubernetes-dashboard service

kind: Service
apiVersion: v1
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kube-system
  annotations:
    # service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
spec:
  type: LoadBalancer
  # loadBalancerSourceRanges:
  # - x.x.x.x/32
  ports:
  - port: 80
    targetPort: 8443
    protocol: TCP
  selector:
    k8s-app: kubernetes-dashboard

Then I hit the ELB DNS record and nothing return (eg - xxxxxxxxxxx.us-east-1.elb.amazonaws.com).

Anyone know how to fix this issue?

note - This is a POC cluster and I don't have any issue with security concern at the moment.

Thank you

-- Gayan
kubectl
kubernetes
kubernetes-dashboard

1 Answer

7/18/2018
kind: Service
apiVersion: v1
metadata:
  labels:
    k8s-app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kube-system
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
spec:
  type: LoadBalancer
  ports:
    - port: 443
      protocol: TCP
      targetPort: 8443
  selector:
    k8s-app: kubernetes-dashboard

And https://<internal-lb-dns-record> should work.

-- Gayan
Source: StackOverflow