简体   繁体   中英

kubernetes guesbook example on aws

I'm trying to run through the kubernetes example in AWS. I created the master and 4 nodes with the kube-up.sh script and trying to get the frontend exposed via a load balancer.

Here are the pods

root@ip-172-20-0-9:~/kubernetes# kubectl get pods
NAME                 READY     STATUS    RESTARTS   AGE
frontend-2q0at       1/1       Running   0          5m
frontend-5hmxq       1/1       Running   0          5m
frontend-s7i0r       1/1       Running   0          5m
redis-master-y6160   1/1       Running   0          53m
redis-slave-49gya    1/1       Running   0          24m
redis-slave-85u1r    1/1       Running   0          24m

Here are the services

root@ip-172-20-0-9:~/kubernetes# kubectl get services
NAME           CLUSTER_IP    EXTERNAL_IP   PORT(S)    SELECTOR            AGE
kubernetes     10.0.0.1      <none>        443/TCP    <none>              1h
redis-master   10.0.90.210   <none>        6379/TCP   name=redis-master   37m
redis-slave    10.0.205.92   <none>        6379/TCP   name=redis-slave    24m

I edited the yml for the frontend service to try to add a load balancer but its not showing up

root@ip-172-20-0-9:~/kubernetes# cat examples/guestbook/frontend-service.yaml
apiVersion: v1
kind: Service
metadata:
  name: frontend
  labels:
    name: frontend
spec:
  # if your cluster supports it, uncomment the following to automatically create
  # an external load-balanced IP for the frontend service.
  type: LoadBalancer
  ports:
    # the port that this service should serve on
    - port: 80
  selector:
    name: frontend

Here the commands i ran

root@ip-172-20-0-9:~/kubernetes# kubectl create -f examples/guestbook/frontend-controller.yaml
replicationcontroller "frontend" created
root@ip-172-20-0-9:~/kubernetes# kubectl get services
NAME           CLUSTER_IP    EXTERNAL_IP   PORT(S)    SELECTOR            AGE
kubernetes     10.0.0.1      <none>        443/TCP    <none>              1h
redis-master   10.0.90.210   <none>        6379/TCP   name=redis-master   39m
redis-slave    10.0.205.92   <none>        6379/TCP   name=redis-slave    26m

If I remove the loadbalancer it loads up but with no external IP

Looks like the external IP might only be there for Google's platform. in AWS it creates a ELB and doesn't show the external IP of the ELB.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM