3

i try to use AWS to setup kubernetes(version 1.0.1) and deploy a few services and pods there.

but i have got stuck with LoadBalancer service. According to the docs i just need to setup correct type of service and open ports in firewall

But service doesn't receive external IP. (ingress is empty)

Do i need to create LoadBalancer manually in AWS console? maybe some another actions?

Thanks,

hamsterksu
  • 125
  • 10
  • what does `kubectl describe service ` output? – CJ Cullen Aug 17 '15 at 17:42
  • `Name: main Namespace: default Labels: name=main Selector: name=main Type: LoadBalancer IP: 10.244.250.177 Port: 30790/TCP NodePort: 32194/TCP Endpoints: Session Affinity: None No events.` – hamsterksu Aug 17 '15 at 18:37

2 Answers2

2

The LoadBalancer should be getting created automatically.

There might be IAM policy issues preventing the load balancer from being created (see Issue #10692).

If that isn't the problem, looking for errors in /var/log/kube-controller-manager.log on the master VM may give you an idea of what is going wrong.

CJ Cullen
  • 5,452
  • 1
  • 26
  • 34
  • i forgot to say that we use juju to deploy kubernetes. also i ahve found the following error message - _No cloud provider specified_. seems juju didn't setup some varianbles – hamsterksu Aug 17 '15 at 18:46
  • similar issue without answer - http://stackoverflow.com/questions/31616916/how-to-access-kubernetes-service-load-balancer-with-juju – hamsterksu Aug 17 '15 at 18:57
  • The kube-controller-manager has to be run with `--cloud-provider=aws` in order to manage AWS resources. I'm not sure how this works with juju. – CJ Cullen Aug 17 '15 at 20:23
  • do i need to provide some AWS credentials/configuration file for aws provider – hamsterksu Aug 18 '15 at 10:09
  • 1
    A lot of the deployment details are handled by `KUBERNETES_PROVIDER=AWS`. A lot of that is not going to work the same using `KUBERNETES_PROVIDER=JUJU` I've added the Juju tag to the question. Maybe @lazyPower or @matt-bruzek can chime in (they did most/all of the kubernetes juju support). – CJ Cullen Aug 19 '15 at 20:37
0

This step is different whether you are using kubernetes over google cloud (where External IP is shown by issuing kubectl get svc ) or over amazon aws. After launching your cluster (aws or gcloud) then deploying your app using kubectl create -f some-deployment.yaml you issue

kubectl expose rs your-pod-name  --type="LoadBalancer"

to expose your app ... then chill a few minutes until command

kubectl get pods

responds back with column STATUS has value Running ... only then issue

kubectl get svc

which after a few minutes will show EXTERNAL-IP on gcloud as per

NAME                       CLUSTER-IP       EXTERNAL-IP       PORT(S)                   AGE
kubernetes                 10.123.240.1     <none>            443/TCP                   10m
loudspeed-deployment-210   10.123.247.54    104.196.113.166   3000/TCP,80/TCP,443/TCP   1m
mongo                      10.123.244.245   <none>            27017/TCP                 5m

whereas on aws the EXTERNAL-IP will partially display the URL of your LoadBalancer Ingress ... to see the full URL just issue

kubectl describe svc

typical output would be

Labels:         app=my-cool-app,pod-template-hash=494629853
Selector:       app=my-cool-app,pod-template-hash=494629853
Type:           LoadBalancer
IP:         10.0.154.138
LoadBalancer Ingress:   a53bigscarystring33e-20075.us-east-1.elb.amazonaws.com
Port:           port-1  80/TCP
NodePort:       port-1  30487/TCP
Endpoints:      10.244.0.3:80
Port:           port-2  443/TCP
NodePort:       port-2  32698/TCP
Endpoints:      10.244.0.3:443
Session Affinity:   None
Events:
  FirstSeen LastSeen    Count   From            SubobjectPath   Type        Reason          Message
  --------- --------    -----   ----            -------------   --------    ------          -------
  14m       14m     1   {service-controller }           Normal      CreatingLoadBalancer    Creating load balancer
  13m       13m     1   {service-controller }           Normal      CreatedLoadBalancer Created load balancer


Name:           mongo
Labels:         name=mongo
Selector:       name=mongo
Type:           ClusterIP
IP:         10.0.63.81
Port:           <unset> 27017/TCP
Endpoints:      10.244.0.4:27017
Session Affinity:   None
No events.

note in above value of

    LoadBalancer Ingress:   a53bigscarystring33e-20075.us-east-1.elb.amazonaws.com

that is your External URL which is visible from command line using

curl a53bigscarystring33e-20075.us-east-1.elb.amazonaws.com

and is typically mapped to your publicly visible domain in your aws Route 53 console on the Resource Type A auto refreshed picklist

See details like ( we do not automatically open NodePort services in the AWS firewall) https://github.com/kubernetes/kubernetes/blob/release-1.3/docs/design/aws_under_the_hood.md

Scott Stensland
  • 26,870
  • 12
  • 93
  • 104