first commit
This commit is contained in:
commit
ba848e218d
1001 changed files with 152333 additions and 0 deletions
45
CloudNative/Kubernetes/Base/k8s-svc.md
Normal file
45
CloudNative/Kubernetes/Base/k8s-svc.md
Normal file
|
@ -0,0 +1,45 @@
|
|||
```
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: svc-demo
|
||||
namespace: default
|
||||
spec:
|
||||
selector: # 选择器,与rs标签匹配
|
||||
app: rs-demo
|
||||
type: ClusterIP # 仅仅使用一个集群内部的IP地址 - 这是默认值。选择这个值意味着你只想这个服务在集群内部才可以被访问到
|
||||
clusterIP: 172.10.1.9
|
||||
ports:
|
||||
port: 80
|
||||
targetPort:80
|
||||
```
|
||||
```
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: svc-demo
|
||||
namespace: default
|
||||
spec:
|
||||
selector: # 选择器,与rs标签匹配
|
||||
app: rs-demo
|
||||
type: NodePort # 在集群内部IP的基础上,在集群的每一个节点的端口上开放这个服务。你可以在任意<NodeIP>:NodePort地址上访问到这个服务。
|
||||
# clusterIP: 172.10.1.9
|
||||
ports:
|
||||
port: 80
|
||||
targetPort:80
|
||||
```
|
||||
```
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: svc-demo
|
||||
namespace: default
|
||||
spec:
|
||||
selector: # 选择器,与rs标签匹配
|
||||
app: rs-demo
|
||||
type: None # None无头svc,headless,一般用于statefulset,有状态的
|
||||
# clusterIP: 172.10.1.9
|
||||
ports:
|
||||
port: 80
|
||||
targetPort:80
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue