【发布时间】:2018-07-29 07:36:21
【问题描述】:
我的入口服务中有以下配置:
apiVersion: v1
kind: Service
metadata:
name: nginx-ingress
namespace: nginx-ingress
spec:
externalTrafficPolicy: Local
type: LoadBalancer
loadBalancerIP: **.***.**.***
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
- port: 443
targetPort: 443
protocol: TCP
name: https
selector:
app: nginx-ingress
我们从 azure 购买了这个公共 IP。如果我们从服务 yaml 中删除这个 loadBalancerIP 并部署,然后使用kubectl get services -n nginx-ingress 列出的 ip,当我们访问服务端点时它工作正常。但是使用这个公共 ip 似乎没有任何效果。
请查看以下服务说明 (kubectl describe service nginx-ingress -n nginx-ingress-os):
[openapianil@LHGOPENAPIDEV001 github]$ kubectl describe service nginx-ingress -n nginx-ingress-os
Name: nginx-ingress
Namespace: nginx-ingress-os
Labels: <none>
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"nginx-ingress","namespace":"nginx-ingress-os"},"spec":{"externalTrafficPolicy"...
Selector: app=nginx-ingress
Type: LoadBalancer
IP: 10.0.0.44
IP: **.**.**.***
LoadBalancer Ingress: **.**.**.***
Port: http 80/TCP
TargetPort: 80/TCP
NodePort: http 31247/TCP
Endpoints: **.**.**.***:80
Port: https 443/TCP
TargetPort: 443/TCP
NodePort: https 32241/TCP
Endpoints: **.**.**.***:443
Session Affinity: None
External Traffic Policy: Local
HealthCheck NodePort: 30880
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal EnsuringLoadBalancer 1m service-controller Ensuring load balancer
Normal EnsuredLoadBalancer 43s service-controller Ensured load balancer
请帮忙!!
【问题讨论】:
-
指定公网IP后,该服务是否部署成功?您能否运行此命令
kubectl describe service nginx-ingress并将该输出发布到您的问题中? -
@JasonYe-MSFT 更新了我的问题陈述。请帮忙。
标签: azure nginx kubernetes