Created
December 23, 2020 03:06
-
-
Save miend/d3e1b4dda5225ad2fcadd83384a498b4 to your computer and use it in GitHub Desktop.
Nginx "Test Page" Deployment Example in Kubernetes
This file contains hidden or 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: 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