unify all service yaml: use 2 spaces indent (#4754)
This commit is contained in:
parent
68def552fb
commit
e81e3c8464
|
|
@ -17957,10 +17957,10 @@ Appears In <a href="#ingress-v1beta1">Ingress</a> </aside>
|
||||||
<span class="hljs-attr"> name:</span> service-example
|
<span class="hljs-attr"> name:</span> service-example
|
||||||
<span class="hljs-attr">spec:</span>
|
<span class="hljs-attr">spec:</span>
|
||||||
<span class="hljs-attr"> ports:</span>
|
<span class="hljs-attr"> ports:</span>
|
||||||
<span class="hljs-comment"># Accept traffic sent to port 80</span>
|
<span class="hljs-comment"># Accept traffic sent to port 80</span>
|
||||||
<span class="hljs-attr"> - name:</span> http
|
<span class="hljs-attr"> - name:</span> http
|
||||||
<span class="hljs-attr"> port:</span> <span class="hljs-number">80</span>
|
<span class="hljs-attr"> port:</span> <span class="hljs-number">80</span>
|
||||||
<span class="hljs-attr"> targetPort:</span> <span class="hljs-number">80</span>
|
<span class="hljs-attr"> targetPort:</span> <span class="hljs-number">80</span>
|
||||||
<span class="hljs-attr"> selector:</span>
|
<span class="hljs-attr"> selector:</span>
|
||||||
<span class="hljs-comment"># Loadbalance traffic across Pods matching</span>
|
<span class="hljs-comment"># Loadbalance traffic across Pods matching</span>
|
||||||
<span class="hljs-comment"># this label selector</span>
|
<span class="hljs-comment"># this label selector</span>
|
||||||
|
|
@ -17981,10 +17981,10 @@ Appears In <a href="#ingress-v1beta1">Ingress</a> </aside>
|
||||||
<span class="hljs-attr"> name:</span> service-example
|
<span class="hljs-attr"> name:</span> service-example
|
||||||
<span class="hljs-attr">spec:</span>
|
<span class="hljs-attr">spec:</span>
|
||||||
<span class="hljs-attr"> ports:</span>
|
<span class="hljs-attr"> ports:</span>
|
||||||
<span class="hljs-comment"># Accept traffic sent to port 80</span>
|
<span class="hljs-comment"># Accept traffic sent to port 80</span>
|
||||||
<span class="hljs-attr"> - name:</span> http
|
<span class="hljs-attr"> - name:</span> http
|
||||||
<span class="hljs-attr"> port:</span> <span class="hljs-number">80</span>
|
<span class="hljs-attr"> port:</span> <span class="hljs-number">80</span>
|
||||||
<span class="hljs-attr"> targetPort:</span> <span class="hljs-number">80</span>
|
<span class="hljs-attr"> targetPort:</span> <span class="hljs-number">80</span>
|
||||||
<span class="hljs-attr"> selector:</span>
|
<span class="hljs-attr"> selector:</span>
|
||||||
<span class="hljs-comment"># Loadbalance traffic across Pods matching</span>
|
<span class="hljs-comment"># Loadbalance traffic across Pods matching</span>
|
||||||
<span class="hljs-comment"># this label selector</span>
|
<span class="hljs-comment"># this label selector</span>
|
||||||
|
|
@ -18156,11 +18156,11 @@ metadata:
|
||||||
name: service-example
|
name: service-example
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: nginx
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
'</span> | kubectl create <span class="hljs-_">-f</span> -
|
'</span> | kubectl create <span class="hljs-_">-f</span> -
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
@ -18176,11 +18176,11 @@ metadata:
|
||||||
name: service-example
|
name: service-example
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: nginx
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
'</span> <span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/127.0.0.1:8001/api</span><span class="hljs-regexp">/v1/namespaces</span><span class="hljs-regexp">/default/services</span>
|
'</span> <span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/127.0.0.1:8001/api</span><span class="hljs-regexp">/v1/namespaces</span><span class="hljs-regexp">/default/services</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
|
||||||
|
|
@ -17849,10 +17849,10 @@ Appears In <a href="#ingress-v1beta1-extensions">Ingress</a> </aside>
|
||||||
<span class="hljs-attr"> name:</span> service-example
|
<span class="hljs-attr"> name:</span> service-example
|
||||||
<span class="hljs-attr">spec:</span>
|
<span class="hljs-attr">spec:</span>
|
||||||
<span class="hljs-attr"> ports:</span>
|
<span class="hljs-attr"> ports:</span>
|
||||||
<span class="hljs-comment"># Accept traffic sent to port 80</span>
|
<span class="hljs-comment"># Accept traffic sent to port 80</span>
|
||||||
<span class="hljs-attr"> - name:</span> http
|
<span class="hljs-attr"> - name:</span> http
|
||||||
<span class="hljs-attr"> port:</span> <span class="hljs-number">80</span>
|
<span class="hljs-attr"> port:</span> <span class="hljs-number">80</span>
|
||||||
<span class="hljs-attr"> targetPort:</span> <span class="hljs-number">80</span>
|
<span class="hljs-attr"> targetPort:</span> <span class="hljs-number">80</span>
|
||||||
<span class="hljs-attr"> selector:</span>
|
<span class="hljs-attr"> selector:</span>
|
||||||
<span class="hljs-comment"># Loadbalance traffic across Pods matching</span>
|
<span class="hljs-comment"># Loadbalance traffic across Pods matching</span>
|
||||||
<span class="hljs-comment"># this label selector</span>
|
<span class="hljs-comment"># this label selector</span>
|
||||||
|
|
@ -17873,10 +17873,10 @@ Appears In <a href="#ingress-v1beta1-extensions">Ingress</a> </aside>
|
||||||
<span class="hljs-attr"> name:</span> service-example
|
<span class="hljs-attr"> name:</span> service-example
|
||||||
<span class="hljs-attr">spec:</span>
|
<span class="hljs-attr">spec:</span>
|
||||||
<span class="hljs-attr"> ports:</span>
|
<span class="hljs-attr"> ports:</span>
|
||||||
<span class="hljs-comment"># Accept traffic sent to port 80</span>
|
<span class="hljs-comment"># Accept traffic sent to port 80</span>
|
||||||
<span class="hljs-attr"> - name:</span> http
|
<span class="hljs-attr"> - name:</span> http
|
||||||
<span class="hljs-attr"> port:</span> <span class="hljs-number">80</span>
|
<span class="hljs-attr"> port:</span> <span class="hljs-number">80</span>
|
||||||
<span class="hljs-attr"> targetPort:</span> <span class="hljs-number">80</span>
|
<span class="hljs-attr"> targetPort:</span> <span class="hljs-number">80</span>
|
||||||
<span class="hljs-attr"> selector:</span>
|
<span class="hljs-attr"> selector:</span>
|
||||||
<span class="hljs-comment"># Loadbalance traffic across Pods matching</span>
|
<span class="hljs-comment"># Loadbalance traffic across Pods matching</span>
|
||||||
<span class="hljs-comment"># this label selector</span>
|
<span class="hljs-comment"># this label selector</span>
|
||||||
|
|
@ -18048,11 +18048,11 @@ metadata:
|
||||||
name: service-example
|
name: service-example
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: nginx
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
'</span> | kubectl create <span class="hljs-_">-f</span> -
|
'</span> | kubectl create <span class="hljs-_">-f</span> -
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
@ -18068,11 +18068,11 @@ metadata:
|
||||||
name: service-example
|
name: service-example
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: nginx
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
'</span> <span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/127.0.0.1:8001/api</span><span class="hljs-regexp">/v1/namespaces</span><span class="hljs-regexp">/default/services</span>
|
'</span> <span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/127.0.0.1:8001/api</span><span class="hljs-regexp">/v1/namespaces</span><span class="hljs-regexp">/default/services</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
|
||||||
|
|
@ -17914,10 +17914,10 @@ metadata:
|
||||||
</span> name: service-example
|
</span> name: service-example
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
# Accept traffic sent <span class="hljs-keyword">to</span><span class="hljs-built_in"> port </span>80
|
# Accept traffic sent <span class="hljs-keyword">to</span><span class="hljs-built_in"> port </span>80
|
||||||
- name: http
|
- name: http
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
# Loadbalance traffic across Pods matching
|
# Loadbalance traffic across Pods matching
|
||||||
# this label selector
|
# this label selector
|
||||||
|
|
@ -17938,10 +17938,10 @@ metadata:
|
||||||
</span> name: service-example
|
</span> name: service-example
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
# Accept traffic sent <span class="hljs-keyword">to</span><span class="hljs-built_in"> port </span>80
|
# Accept traffic sent <span class="hljs-keyword">to</span><span class="hljs-built_in"> port </span>80
|
||||||
- name: http
|
- name: http
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
# Loadbalance traffic across Pods matching
|
# Loadbalance traffic across Pods matching
|
||||||
# this label selector
|
# this label selector
|
||||||
|
|
@ -18129,11 +18129,11 @@ $ echo 'kind: Service
|
||||||
name</span>: service-example
|
name</span>: service-example
|
||||||
<span class="hljs-attribute">spec:
|
<span class="hljs-attribute">spec:
|
||||||
ports:
|
ports:
|
||||||
- name</span>: http
|
- name</span>: http
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: nginx
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
' | kubectl create -f -
|
' | kubectl create -f -
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
@ -18149,11 +18149,11 @@ metadata:
|
||||||
name: service-example
|
name: service-example
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: nginx
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
'</span> <span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/127.0.0.1:8001/api</span><span class="hljs-regexp">/v1/namespaces</span><span class="hljs-regexp">/default/services</span>
|
'</span> <span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/127.0.0.1:8001/api</span><span class="hljs-regexp">/v1/namespaces</span><span class="hljs-regexp">/default/services</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
|
||||||
|
|
@ -101,9 +101,9 @@ spec:
|
||||||
name: busybox
|
name: busybox
|
||||||
clusterIP: None
|
clusterIP: None
|
||||||
ports:
|
ports:
|
||||||
- name: foo # Actually, no port is needed.
|
- name: foo # Actually, no port is needed.
|
||||||
port: 1234
|
port: 1234
|
||||||
targetPort: 1234
|
targetPort: 1234
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,9 @@ spec:
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app: MyApp
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 9376
|
targetPort: 9376
|
||||||
```
|
```
|
||||||
|
|
||||||
This specification will create a new `Service` object named "my-service" which
|
This specification will create a new `Service` object named "my-service" which
|
||||||
|
|
@ -97,9 +97,9 @@ metadata:
|
||||||
name: my-service
|
name: my-service
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 9376
|
targetPort: 9376
|
||||||
```
|
```
|
||||||
|
|
||||||
Because this service has no selector, the corresponding `Endpoints` object will not be
|
Because this service has no selector, the corresponding `Endpoints` object will not be
|
||||||
|
|
@ -216,17 +216,17 @@ apiVersion: v1
|
||||||
metadata:
|
metadata:
|
||||||
name: my-service
|
name: my-service
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app: MyApp
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 9376
|
targetPort: 9376
|
||||||
- name: https
|
- name: https
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
port: 443
|
port: 443
|
||||||
targetPort: 9377
|
targetPort: 9377
|
||||||
```
|
```
|
||||||
|
|
||||||
## Choosing your own IP address
|
## Choosing your own IP address
|
||||||
|
|
@ -404,17 +404,17 @@ spec:
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app: MyApp
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 9376
|
targetPort: 9376
|
||||||
nodePort: 30061
|
nodePort: 30061
|
||||||
clusterIP: 10.0.171.239
|
clusterIP: 10.0.171.239
|
||||||
loadBalancerIP: 78.11.24.19
|
loadBalancerIP: 78.11.24.19
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
status:
|
status:
|
||||||
loadBalancer:
|
loadBalancer:
|
||||||
ingress:
|
ingress:
|
||||||
- ip: 146.148.47.155
|
- ip: 146.148.47.155
|
||||||
```
|
```
|
||||||
|
|
||||||
Traffic from the external load balancer will be directed at the backend `Pods`,
|
Traffic from the external load balancer will be directed at the backend `Pods`,
|
||||||
|
|
@ -531,12 +531,12 @@ spec:
|
||||||
selector:
|
selector:
|
||||||
app: MyApp
|
app: MyApp
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 9376
|
targetPort: 9376
|
||||||
externalIPs:
|
externalIPs:
|
||||||
- 80.11.12.10
|
- 80.11.12.10
|
||||||
```
|
```
|
||||||
|
|
||||||
## Shortcomings
|
## Shortcomings
|
||||||
|
|
|
||||||
|
|
@ -157,9 +157,9 @@ metadata:
|
||||||
name: myservice
|
name: myservice
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 9376
|
targetPort: 9376
|
||||||
---
|
---
|
||||||
kind: Service
|
kind: Service
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|
@ -167,9 +167,9 @@ metadata:
|
||||||
name: mydb
|
name: mydb
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 9377
|
targetPort: 9377
|
||||||
```
|
```
|
||||||
|
|
||||||
This Pod can be started and debugged with the following commands:
|
This Pod can be started and debugged with the following commands:
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ metadata:
|
||||||
name: myapp
|
name: myapp
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- port: 8765
|
- port: 8765
|
||||||
targetPort: 9376
|
targetPort: 9376
|
||||||
selector:
|
selector:
|
||||||
app: example
|
app: example
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
|
|
@ -44,8 +44,8 @@ metadata:
|
||||||
name: myapp
|
name: myapp
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- port: 8765
|
- port: 8765
|
||||||
targetPort: 9376
|
targetPort: 9376
|
||||||
selector:
|
selector:
|
||||||
app: example
|
app: example
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ spec:
|
||||||
app: hello
|
app: hello
|
||||||
tier: frontend
|
tier: frontend
|
||||||
ports:
|
ports:
|
||||||
- protocol: "TCP"
|
- protocol: "TCP"
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: 80
|
targetPort: 80
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1beta1
|
apiVersion: apps/v1beta1
|
||||||
|
|
@ -26,9 +26,9 @@ spec:
|
||||||
track: stable
|
track: stable
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: nginx
|
- name: nginx
|
||||||
image: "gcr.io/google-samples/hello-frontend:1.0"
|
image: "gcr.io/google-samples/hello-frontend:1.0"
|
||||||
lifecycle:
|
lifecycle:
|
||||||
preStop:
|
preStop:
|
||||||
exec:
|
exec:
|
||||||
command: ["/usr/sbin/nginx","-s","quit"]
|
command: ["/usr/sbin/nginx","-s","quit"]
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,6 @@ spec:
|
||||||
app: hello
|
app: hello
|
||||||
tier: backend
|
tier: backend
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: 80
|
port: 80
|
||||||
targetPort: http
|
targetPort: http
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ metadata:
|
||||||
name: mysql
|
name: mysql
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- port: 3306
|
- port: 3306
|
||||||
selector:
|
selector:
|
||||||
app: mysql
|
app: mysql
|
||||||
clusterIP: None
|
clusterIP: None
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,6 @@ metadata:
|
||||||
spec:
|
spec:
|
||||||
clusterIP: None
|
clusterIP: None
|
||||||
ports:
|
ports:
|
||||||
- port: 9042
|
- port: 9042
|
||||||
selector:
|
selector:
|
||||||
app: cassandra
|
app: cassandra
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ metadata:
|
||||||
name: redis
|
name: redis
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- port: 6379
|
- port: 6379
|
||||||
targetPort: 6379
|
targetPort: 6379
|
||||||
selector:
|
selector:
|
||||||
app: redis
|
app: redis
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ metadata:
|
||||||
name: myapp
|
name: myapp
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- port: 8765
|
- port: 8765
|
||||||
targetPort: 9376
|
targetPort: 9376
|
||||||
selector:
|
selector:
|
||||||
app: example
|
app: example
|
||||||
type: LoadBalancer
|
type: LoadBalancer
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ metadata:
|
||||||
name: myapp
|
name: myapp
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- port: 8765
|
- port: 8765
|
||||||
targetPort: 9376
|
targetPort: 9376
|
||||||
selector:
|
selector:
|
||||||
app: example
|
app: example
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue