Merge pull request #26298 from tengqm/zh-sync-connecting-fb

[zh] Resync connecting-frontend-backend
This commit is contained in:
Kubernetes Prow Robot
2021-02-05 18:05:11 -08:00
committed by GitHub
8 changed files with 152 additions and 114 deletions
@@ -1,14 +1,15 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello
name: backend
spec:
selector:
matchLabels:
app: hello
tier: backend
track: stable
replicas: 7
replicas: 3
template:
metadata:
labels:
@@ -22,3 +23,4 @@ spec:
ports:
- name: http
containerPort: 80
...
@@ -1,3 +1,4 @@
---
apiVersion: v1
kind: Service
metadata:
@@ -10,3 +11,4 @@ spec:
- protocol: TCP
port: 80
targetPort: http
...
@@ -0,0 +1,27 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
selector:
matchLabels:
app: hello
tier: frontend
track: stable
replicas: 1
template:
metadata:
labels:
app: hello
tier: frontend
track: stable
spec:
containers:
- name: nginx
image: "gcr.io/google-samples/hello-frontend:1.0"
lifecycle:
preStop:
exec:
command: ["/usr/sbin/nginx","-s","quit"]
...
@@ -0,0 +1,14 @@
# The identifier Backend is internal to nginx, and used to name this specific upstream
upstream Backend {
# hello is the internal DNS name used by the backend Service inside Kubernetes
server hello;
}
server {
listen 80;
location / {
# The following statement will proxy traffic to the upstream named Backend
proxy_pass http://Backend;
}
}
@@ -0,0 +1,15 @@
---
apiVersion: v1
kind: Service
metadata:
name: frontend
spec:
selector:
app: hello
tier: frontend
ports:
- protocol: "TCP"
port: 80
targetPort: 80
type: LoadBalancer
...
@@ -1,11 +0,0 @@
upstream hello {
server hello;
}
server {
listen 80;
location / {
proxy_pass http://hello;
}
}
@@ -1,39 +0,0 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
spec:
selector:
app: hello
tier: frontend
ports:
- protocol: "TCP"
port: 80
targetPort: 80
type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
selector:
matchLabels:
app: hello
tier: frontend
track: stable
replicas: 1
template:
metadata:
labels:
app: hello
tier: frontend
track: stable
spec:
containers:
- name: nginx
image: "gcr.io/google-samples/hello-frontend:1.0"
lifecycle:
preStop:
exec:
command: ["/usr/sbin/nginx","-s","quit"]