![](/img/trans.png)
[英]Exposing to public more than 1 port with AWS ECS service and Elastic LoadBalancer
[英]Service (LoadBalancer) port not working on aws
我在aws
上的k8s
部署中有一個LoadBalancer
服務(通過kops
)。
服務定義如下:
apiVersion: v1
kind: Service
metadata:
name: ui
annotations:
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: <certificate_id>
spec:
ports:
- name: http
port: 80
targetPort: ui-port
protocol: TCP
- name: https
port: 443
targetPort: ui-port
protocol: TCP
selector:
els-pod: ui
type: LoadBalancer
這是各自的部署:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ui-deployment
spec:
replicas: 1
template:
metadata:
labels:
els-pod: ui
spec:
containers:
- image: <my_ecr_registry>/<my_image>:latest
name: ui
ports:
- name: ui-port
containerPort: 80
restartPolicy: Always
我知道<my_image>
暴露了端口80
。
我還為部署的ELB
分配了別名。 my-k8s.mydomain.org
這是問題所在:
https://my-k8s.mydomain.org
運行正常 http://my-k8s.mydomain.org
返回一個空頁面(當在一個squid
代理后面訪問時,我得到zero-sized reply
錯誤消息) 為什么我無法通過端口80
訪問該服務?
編輯 :我剛剛發現的是有關證書的服務注釋,也將其分配給 ELB的端口80 。
這可能是問題嗎?
有沒有解決的辦法?
只需在服務定義中添加以下注釋:
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.