繁体   English   中英

AWS上的kubernetes guesbook示例

[英]kubernetes guesbook example on aws

我正在尝试通过AWS中的kubernetes示例运行。 我使用kube-up.sh脚本创建了主节点和4个节点,并尝试通过负载均衡器公开前端。

这是豆荚

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

这是服务

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

我为前端服务编辑了yml,以尝试添加负载均衡器,但未显示

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

我在这里运行的命令

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

如果我卸下负载均衡器,它将加载但没有外部IP

看起来外部IP可能仅适用于Google的平台。 在AWS中,它会创建一个ELB,而不显示ELB的外部IP。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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