簡體   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