新增说明及示例文件
This commit is contained in:
60
description/Service/Ingress/description.yml
Normal file
60
description/Service/Ingress/description.yml
Normal file
@@ -0,0 +1,60 @@
|
||||
# Ingress 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/services-networking/ingress
|
||||
# API 版本
|
||||
apiVersion: networking.k8s.io/v1
|
||||
# 资源类型
|
||||
kind: Ingress
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Ingress 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Ingress 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
## 注解(使用不同的控制器时注解不同,具体见官方文档)
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||
# 内容
|
||||
spec:
|
||||
## TLS 证书
|
||||
tls:
|
||||
### TLS 证书1
|
||||
#### 该 TLS 证书对应的 HOST(需要和 rules 中配置的 host 保持一致)
|
||||
- hosts:
|
||||
- host1
|
||||
- host2
|
||||
#### 该 TLS 证书使用的 Secret 名称
|
||||
secretName: 该 TLS 证书使用的 Secret 名称
|
||||
## 规则
|
||||
rules:
|
||||
### 规则1
|
||||
#### HOST
|
||||
- host: HOST
|
||||
#### HTTP 规则
|
||||
http:
|
||||
##### 路径
|
||||
paths:
|
||||
###### 路径1
|
||||
####### 路径
|
||||
- path: 路径
|
||||
####### 路径类型【ImplementationSpecific:视 IngressClass 而定;Prefix:前缀匹配;Exact:精确匹配】
|
||||
pathType: 路径类型
|
||||
####### 后端
|
||||
backend:
|
||||
######## Service 类型(常用于后端服务,不能和 Resource 类型同时配置)
|
||||
service:
|
||||
######### Service 的名称
|
||||
name: Service 的名称
|
||||
######### Service 的端口号
|
||||
port:
|
||||
number: Service 的端口号
|
||||
######## Resource 类型(常用于前端静态资源服务,不能和 Service 类型同时配置)
|
||||
resource:
|
||||
#########
|
||||
apiGroup: k8s.example.com
|
||||
######### 资源类型
|
||||
kind: StorageBucket
|
||||
######### 资源名称
|
||||
name: icon-assets
|
||||
31
description/Service/Ingress/example-multi.yml
Normal file
31
description/Service/Ingress/example-multi.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: example-ingress-multi
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-ingress-multi
|
||||
app: ingress
|
||||
type: ingress
|
||||
spec:
|
||||
rules:
|
||||
- host: "foo.bar.com"
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: "/bar"
|
||||
backend:
|
||||
service:
|
||||
name: service1
|
||||
port:
|
||||
number: 80
|
||||
- host: "*.foo.com"
|
||||
http:
|
||||
paths:
|
||||
- pathType: Prefix
|
||||
path: "/foo"
|
||||
backend:
|
||||
service:
|
||||
name: service2
|
||||
port:
|
||||
number: 80
|
||||
22
description/Service/Ingress/example-single.yml
Normal file
22
description/Service/Ingress/example-single.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: example-ingress-single
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-ingress-single
|
||||
app: ingress
|
||||
type: ingress
|
||||
annotations:
|
||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||
spec:
|
||||
rules:
|
||||
- http:
|
||||
paths:
|
||||
- path: /testpath
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: test
|
||||
port:
|
||||
number: 80
|
||||
25
description/Service/Ingress/example-tls.yml
Normal file
25
description/Service/Ingress/example-tls.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: example-ingress-tls
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-ingress-tls
|
||||
app: ingress
|
||||
type: ingress
|
||||
spec:
|
||||
tls:
|
||||
- hosts:
|
||||
- https-example.foo.com
|
||||
secretName: testsecret-tls
|
||||
rules:
|
||||
- host: https-example.foo.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: service1
|
||||
port:
|
||||
number: 80
|
||||
Reference in New Issue
Block a user