Skip to content

Instantly share code, notes, and snippets.

@kjanshair
Last active September 6, 2020 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjanshair/b9ac78e589725c3ef8382c90086fb9b9 to your computer and use it in GitHub Desktop.
Save kjanshair/b9ac78e589725c3ef8382c90086fb9b9 to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: ConfigMap
metadata:
name: master-500-html
namespace: default
data:
50x.html: |
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (500)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<div class="wrapper">
<main class="main">
<div class="main-holder">
<div class="main-frame">
<div class="container text-center">
<section class="error">
<div class="error-content">
<h1>500</h1>
<h2>We're sorry, but something went wrong.</h2>
<p>If you are the application owner check the logs for more information.</p>
<ul class="list-unstyled list-btn justify-content-center">
<li>
<a href="https://example.com" class="btn btn-light">Go to Home</a>
</li>
</ul>
</div>
</section>
</div>
</div>
</div>
</main>
</div>
</body>
</html>
---
apiVersion: v1
kind: ConfigMap
metadata:
name: master-400-html
namespace: default
data:
40x.html: |
<!DOCTYPE html>
<html>
<head>
<title>We're sorry, but something went wrong (400)</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<div class="wrapper">
<main class="main">
<div class="main-holder">
<div class="main-frame">
<div class="container text-center">
<section class="error">
<div class="error-content">
<h1>400</h1>
<h2>We're sorry, but something went wrong.</h2>
<p>If you are the application owner check the logs for more information.</p>
<ul class="list-unstyled list-btn justify-content-center">
<li>
<a href="https://example.com" class="btn btn-light">Go to Home</a>
</li>
</ul>
</div>
</section>
</div>
</div>
</div>
</main>
</div>
</body>
</html>
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-conf
data:
nginx.conf: |
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
internal;
}
error_page 400 402 403 404 /40x.html;
location = /40x.html {
root /var/www/html;
internal;
}
location /testing {
fastcgi_pass unix:/does/not/exist;
}
}
---
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx
volumeMounts:
- name: nginx-conf
mountPath:
/etc/nginx/conf.d/
- name: htmls
mountPath: /var/www/html
imagePullPolicy: IfNotPresent
volumes:
- name: nginx-conf
configMap:
name: nginx-conf
- name: htmls
projected:
sources:
- configMap:
name: master-400-html
- configMap:
name: master-500-html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment