新增说明及示例文件
This commit is contained in:
25
description/Service/Endpoints/description.yml
Normal file
25
description/Service/Endpoints/description.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
# Endpoint 说明,官方文档:
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: Endpoints
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Endpoint 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Endpoint 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
subsets:
|
||||
## 端点1
|
||||
### 端点地址
|
||||
- addresses:
|
||||
#### 端点 IP
|
||||
- ip: 端点 IP
|
||||
### 端点端口号
|
||||
ports:
|
||||
- port: 端点端口号
|
||||
14
description/Service/Endpoints/example.yml
Normal file
14
description/Service/Endpoints/example.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Endpoints
|
||||
metadata:
|
||||
name: example-endpoints
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-endpoints
|
||||
app: demo
|
||||
type: endpoints
|
||||
subsets:
|
||||
- addresses:
|
||||
- ip: 192.0.2.42
|
||||
ports:
|
||||
- port: 9376
|
||||
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
|
||||
42
description/Service/Service/description.yml
Normal file
42
description/Service/Service/description.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
# Service 说明,官方文档: https://v1-22.docs.kubernetes.io/zh/docs/concepts/services-networking/service
|
||||
# API 版本
|
||||
apiVersion: v1
|
||||
# 资源类型
|
||||
kind: Service
|
||||
# 元数据
|
||||
metadata:
|
||||
## 名称
|
||||
name: 此 Service 的名称
|
||||
## 命名空间
|
||||
namespace: 此 Service 所属命名空间
|
||||
## 标签
|
||||
labels:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
# 内容
|
||||
spec:
|
||||
## 指定 Service 类型【ClusterIP:通过集群的内部 IP 暴露服务,选择该值时服务只能够在集群内部访问;NodePort:通过每个节点上的 IP 和静态端口(NodePort)暴露服务;LoadBalancer:使用云提供商的负载均衡器向外部暴露服务;ExternalName:通过返回 CNAME 和对应值,可以将服务映射到 externalName 字段的内容】
|
||||
type: Service 类型
|
||||
## 指定 Pod 选择器( 此 Service 需要暴露哪些 Pod )
|
||||
selector:
|
||||
标签名1: 标签值1
|
||||
标签名2: 标签值2
|
||||
## 端口号
|
||||
ports:
|
||||
### 端口号1
|
||||
#### 端口名称
|
||||
- name:
|
||||
#### 端口类型
|
||||
protocol: 端口类型
|
||||
#### Service 端口号
|
||||
port: Service 端口号
|
||||
#### Pod 端口号
|
||||
targetPort: Pod 端口号
|
||||
### Node 端口号(仅 type 为 NodePort 时使用)
|
||||
nodePort: Node 端口号
|
||||
## ExternalName(仅 type 为 ExternalName 时使用)
|
||||
externalName: ExternalName
|
||||
## 指定外部IP(该 Service 允许通过哪些外部 IP:Port 访问)
|
||||
externalIPs:
|
||||
- externalIP1:Port1
|
||||
- externalIP2:Port2
|
||||
16
description/Service/Service/example-externalips.yml
Normal file
16
description/Service/Service/example-externalips.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: example-externalips
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-externalips
|
||||
app: demo
|
||||
type: service
|
||||
spec:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: 9376
|
||||
externalIPs:
|
||||
- 80.11.12.10
|
||||
12
description/Service/Service/example-externalname.yml
Normal file
12
description/Service/Service/example-externalname.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: example-externalname
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-externalname
|
||||
app: demo
|
||||
type: service
|
||||
spec:
|
||||
type: ExternalName
|
||||
externalName: my.database.example.com
|
||||
21
description/Service/Service/example-multi.yml
Normal file
21
description/Service/Service/example-multi.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: example-multi
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-multi
|
||||
app: demo
|
||||
type: service
|
||||
spec:
|
||||
selector:
|
||||
app: app1
|
||||
ports:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 80
|
||||
targetPort: 9376
|
||||
- name: https
|
||||
protocol: TCP
|
||||
port: 443
|
||||
targetPort: 9377
|
||||
17
description/Service/Service/example-nodeport.yml
Normal file
17
description/Service/Service/example-nodeport.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: example-nodeport
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-nodeport
|
||||
app: demo
|
||||
type: service
|
||||
spec:
|
||||
selector:
|
||||
app: app1
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 80
|
||||
nodePort: 30007
|
||||
16
description/Service/Service/example-single.yml
Normal file
16
description/Service/Service/example-single.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: example-single
|
||||
namespace: demo
|
||||
labels:
|
||||
name: example-single
|
||||
app: demo
|
||||
type: service
|
||||
spec:
|
||||
selector:
|
||||
app: app1
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 9376
|
||||
Reference in New Issue
Block a user