[英]Service (LoadBalancer) port not working on aws
I have a LoadBalancer
service on a k8s
deployment on aws
(made via kops
). 我在
aws
上的k8s
部署中有一个LoadBalancer
服务(通过kops
)。
Service definition is as follows: 服务定义如下:
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
Here is the respective deployment: 这是各自的部署:
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
I know that <my_image>
exposes port 80
. 我知道
<my_image>
暴露了端口80
。
I have also assigned an alias to the ELB
that gets deployed, say. 我还为部署的
ELB
分配了别名。 my-k8s.mydomain.org
Here is the issue: 这是问题所在:
https://my-k8s.mydomain.org
works just fine https://my-k8s.mydomain.org
运行正常 http://my-k8s.mydomain.org
returns an empty page (when accessing behind a squid
proxy, I get the zero-sized reply
error message) http://my-k8s.mydomain.org
返回一个空页面(当在一个squid
代理后面访问时,我得到zero-sized reply
错误消息) Why am I unable to access the service via port 80
? 为什么我无法通过端口
80
访问该服务?
edit : what I have just found is that the service annotation regarding the certificate, also assigns it on port 80 on the ELB. 编辑 :我刚刚发现的是有关证书的服务注释,也将其分配给 ELB的端口80 。
Could that be the issue? 这可能是问题吗?
Is there a way around this? 有没有解决的办法?
只需在服务定义中添加以下注释:
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "443"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.