Created
January 26, 2018 09:00
-
-
Save watawuwu/5b47c17fabb015773766b8840380140f to your computer and use it in GitHub Desktop.
NginxのGracefulShutdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: nginx | |
labels: | |
app: nginx | |
spec: | |
replicas: 2 | |
template: | |
metadata: | |
labels: | |
app: nginx | |
spec: | |
containers: | |
- name: nginx | |
image: watawuwu/openresty-quit | |
ports: | |
- containerPort: 80 | |
name: http | |
volumeMounts: | |
- name: nginx-volume | |
mountPath: /usr/local/openresty/nginx/conf | |
volumes: | |
- name: nginx-volume | |
configMap: | |
name: nginx-conf | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: nginx-conf | |
data: | |
nginx.conf: | | |
error_log stderr debug; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
server { | |
location /sleep { | |
default_type 'text/plain'; | |
content_by_lua_block { | |
ngx.sleep(10) | |
ngx.say('Hello!!') | |
} | |
} | |
location / { | |
root html; | |
index index.html index.htm; | |
} | |
} | |
} | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: nginx | |
spec: | |
selector: | |
app: nginx | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 80 | |
type: NodePort | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: nginx | |
spec: | |
backend: | |
serviceName: nginx | |
servicePort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: nginx | |
labels: | |
app: nginx | |
spec: | |
replicas: 2 | |
template: | |
metadata: | |
labels: | |
app: nginx | |
spec: | |
containers: | |
- name: nginx | |
image: openresty/openresty:xenial | |
ports: | |
- containerPort: 80 | |
name: http | |
lifecycle: | |
preStop: | |
exec: | |
command: ["/usr/local/openresty/bin/openresty", "-s", "quit"] | |
volumeMounts: | |
- name: nginx-volume | |
mountPath: /usr/local/openresty/nginx/conf | |
volumes: | |
- name: nginx-volume | |
configMap: | |
name: nginx-conf | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: nginx-conf | |
data: | |
nginx.conf: | | |
error_log stderr debug; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
server { | |
location /sleep { | |
default_type 'text/plain'; | |
content_by_lua_block { | |
ngx.sleep(10) | |
ngx.say('Hello!!') | |
} | |
} | |
location / { | |
root html; | |
index index.html index.htm; | |
} | |
} | |
} | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: nginx | |
spec: | |
selector: | |
app: nginx | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 80 | |
type: NodePort | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: nginx | |
spec: | |
backend: | |
serviceName: nginx | |
servicePort: 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment