Skip to content

Instantly share code, notes, and snippets.

@miend
Created December 23, 2020 03:06
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 miend/d3e1b4dda5225ad2fcadd83384a498b4 to your computer and use it in GitHub Desktop.
Save miend/d3e1b4dda5225ad2fcadd83384a498b4 to your computer and use it in GitHub Desktop.
Nginx "Test Page" Deployment Example in Kubernetes
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx
labels:
app: nginx
annotations:
spec:
tls:
# - hosts:
# - k8s-test.example.com
# secretName: k8s-test.example.com-tls
rules:
- host: k8s-test.example.com
http:
paths:
- backend:
serviceName: nginx
servicePort: 80
---
kind: Service
apiVersion: v1
metadata:
name: 'nginx'
spec:
ports:
- name: http
protocol: 'TCP'
port: 80
targetPort: 80
selector:
app: 'nginx'
type: ClusterIP
---
apiVersion: v1
kind: ConfigMap
metadata:
name: testpage
data:
index.html: |
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Docker Nginx</title>
</head>
<body>
<h2>YES HELLO THIS IS TEST</h2>
<h3>How are you?</h3>
</body>
</html>
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels:
app: nginx
replicas: 3
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
volumeMounts:
- mountPath: /usr/share/nginx/html
readOnly: true
name: testpage
volumes:
- name: testpage
configMap:
name: testpage
items:
- key: index.html
path: index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment