Not geting public DNS name for service(Stuck in pending)-Openshift on AWS

3/18/2018

Followed the installation guide to setup cluster: https://s3.amazonaws.com/quickstart-reference/redhat/openshift/latest/doc/red-hat-openshift-on-the-aws-cloud.pdf

I'm able to get the public DNS name for a service in Kubernetes but not in Openshift. It is very basic thing, I dont know why it is not working?. I'm attaching manifest files that are used to create app and server. It is not working openshift.

prometheus-configmap.yml

prometheus-rbac.yml

prometheus-deployment.yml

In K8s

kubectl apply -f prometheus-configmap.yml
kubectl apply -f prometheus-rbac.yml
kubectl apply -f prometheus-deployment.yml

veeru@ultron:~/prometheus-k8s-monitoring$ kubectl describe svc prometheus-test
Name:                     prometheus-test
Namespace:                default
Labels:                   name=prometheus-test
Annotations:              kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"prometheus.io/scrape":"true"},"labels":{"name":"prometheus-test"},"name":"prometheus-te...
                          prometheus.io/scrape=true
Selector:                 app=prometheus-test
Type:                     LoadBalancer
IP:                       100.xx.xx.xx
LoadBalancer Ingress:     xxxxx-1679955855.us-east-2.elb.amazonaws.com
Port:                     prometheus-test  9090/TCP
TargetPort:               9090/TCP
NodePort:                 prometheus-test  31558/TCP
Endpoints:                100.xx.xx.xx:9090
Session Affinity:         None
External Traffic Policy:  Cluster
Events:
  Type    Reason                Age   From                Message
  ----    ------                ----  ----                -------
  Normal  EnsuringLoadBalancer  9m    service-controller  Ensuring load balancer
  Normal  EnsuredLoadBalancer   9m    service-controller  Ensured load balancer

In above you can see that I got the LoadBalancer Ingress with public DNS name.

In Openshift

kubectl apply -f prometheus-configmap.yml
kubectl apply -f prometheus-rbac.yml
kubectl apply -f prometheus-deployment.yml

root@ultron:/home/veeru/prometheus-k8s-monitoring# oc describe svc prometheus-test
Name:           prometheus-test
Namespace:      spinnaker
Labels:         name=prometheus-test
Annotations:        kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Service","metadata":{"annotations":{"prometheus.io/scrape":"true"},"labels":{"name":"prometheus-test"},"name":"prometheus-te...
            prometheus.io/scrape=true
Selector:       app=prometheus-test
Type:           LoadBalancer
IP:         172.30.134.153
Port:           prometheus-test 9090/TCP
NodePort:       prometheus-test 31667/TCP
Endpoints:      <none>
Session Affinity:   None
Events:
  FirstSeen LastSeen    Count   From            SubObjectPath   Type        Reason              Message
  --------- --------    -----   ----            -------------   --------    ------              -------
  10m       36s     8   service-controller          Normal      CreatingLoadBalancer        Creating load balancer
  10m       36s     8   service-controller          Warning     CreatingLoadBalancerFailed  Error creating load balancer (will retry): Failed to create load balancer for service spinnaker/prometheus-test: could not find any suitable subnets for creating the ELB

You can see the status failed to create load balancer for service

If I specify annotation like --> service.beta.kubernetes.io/aws-load-balancer-internal: 0.0.0.0/0

Then I'm able get the "internal" DNS name for service

root@ultron:/home/veeru/prometheus-k8s-monitoring# oc describe svc test4-dev
Name:                     test4-dev
Namespace:                default
Labels:                   <none>
Annotations:              service.beta.kubernetes.io/aws-load-balancer-internal=0.0.0.0/0
Selector:                 load-balancer-test4-dev=true
Type:                     LoadBalancer
IP:                       172.30.177.217
LoadBalancer Ingress:     internal-xxxxx-298335522.us-east-2.elb.amazonaws.com
Port:                     http  8080/TCP
TargetPort:               8080/TCP
NodePort:                 http  31595/TCP
Endpoints:                10.131.0.75:8080
Session Affinity:         None
External Traffic Policy:  Cluster
Events:
  Type    Reason                Age                 From                Message
  ----    ------                ----                ----                -------
  Normal  CreatingLoadBalancer  1m (x208 over 16h)  service-controller  Creating load balancer

Openshift is not using AWS ELB to create public DNS name?.

-- Veerendra Kakumanu
amazon-web-services
kubernetes
openshift

1 Answer

3/29/2018

Ok, instead of relying on AWS load balancer to provide public DNS name. I configured subdomain in /etc/openshift/master/master-config.yaml.

  1. Create A recode(Wildcard DNS); *.cluster.example.com -> Your master IP

  2. Specify in /etc/openshift/master/master-config.yaml

routingConfig:

  subdomain: cluster.example.com

serviceAccountConfig
  1. Restart daemans

systemctl restart atomic-openshift-master-api atomic-openshift-master-controllers

After this you should able to create Openshift Route

Resources:

-- Veerendra Kakumanu
Source: StackOverflow