今天学习使用Helm安装NginxIngress是发现配置清单中有一个有趣的Service,如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# Source: ingress-nginx/templates/controller-service.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
labels:
helm.sh/chart: ingress-nginx-4.0.15
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/version: "1.1.1"
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/component: controller
name: ingress-nginx-controller
namespace: ingress-nginx
spec:
type: LoadBalancer
ipFamilyPolicy: SingleStack
ipFamilies:
- IPv4
ports:
- name: http
port: 80
protocol: TCP
targetPort: http
appProtocol: http
- name: https
port: 443
protocol: TCP
targetPort: https
appProtocol: https
selector:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/component: controller
|
这个Service的type为LoadBalancer,这个有点颠覆我之前对LocalBalancer的理解,之前的理解中LocalBalancer需要在云环境中才能使用,而我的环境时我自己搭建的。使用kubectl get service -n ingress-nginx
,得到如下输出:
ingress-nginx-controller LoadBalancer 10.98.152.7 <pending> 80:30062/TCP,443:32440/TCP 160m
ingress-nginx-controller-admission ClusterIP 10.102.86.84 <none> 443/TCP 160m
160m
此时请注意,ingress-nginx-controller
的EXTERNAL-IP字段的状态始终为pending。我有通过节点IP加端口进行测试,是可以正常访问的。
我暂时得不到更多的知识点了,