I have set up a private K8 cluster on AWS using kops with 1 master and 5 nodes. The master and the worker nodes are on a vpc which has 172.20.*.*
subnet. We have another vpc for dev environment which has instances on the 172.17.*.*
subnet.
There is no way to access the nodes on the 172.20 subnet from the 172.17 instances other than using the bastion host. Now, I have installed the kube-dashboard and configured a service to expose the dashboard so that instances on 172.17 can access it but it's not working.
Script to create the 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
spec:
type: LoadBalancer
ports:
- port: 443
protocol: TCP
targetPort: 8443
selector:
k8s-app: kubernetes-dashboard
kubectl describe services kubernetes-dashboard -n kube-system
Name: kubernetes-dashboard
Namespace: kube-system
Labels: k8s-app=kubernetes-dashboard
Annotations: kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"service.beta.kubernetes.io/aws-load-balancer-internal":"0.0.0.0/0"},"label...
service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0
Selector: k8s-app=kubernetes-dashboard Type: LoadBalancer IP: 100.68.65.76
LoadBalancer Ingress:
internal-a29aca39505ba11e9b822124a0b1194c-219044523.us-east-1.elb.amazonaws.com
Port: <unset> 443/TCP
TargetPort: 8443/TCP
NodePort: <unset> 31359/TCP
Endpoints:
100.103.144.50:8443
Session Affinity: None
External Traffic Policy:
Cluster Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Type 19m service-controller ClusterIP -> LoadBalancer Normal EnsuringLoadBalancer 19m service-controller Ensuring load balancer Normal EnsuredLoadBalancer 19m service-controller Ensured load balancer
When I try to connect to the lb `https://internal-a29aca39505ba11e9b822124a0b1194c-219044523.us-east-1.elb.amazonaws.com:443, it times out.
Please let me know what am I doing wrong and how to access the dashboard. Thank you.