Skip to content

Instantly share code, notes, and snippets.

@mfominov
Last active December 27, 2021 12:55
Show Gist options
  • Save mfominov/8ca0b9c4ae23a4c13c793c8c44459814 to your computer and use it in GitHub Desktop.
Save mfominov/8ca0b9c4ae23a4c13c793c8c44459814 to your computer and use it in GitHub Desktop.
move from nginx to nginxinc/nginx-unprivileged
apiVersion: v1
kind: ConfigMap
metadata:
name: world2shift-config
labels:
app: world2shift
data:
index.html: |
<!DOCTYPE html>
<html>
<head>
<title>Hello, world</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Hello, world</h1>
</body>
</html>
---
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: world2shift
labels:
app: world2shift
spec:
selector:
matchLabels:
app: world2shift
replicas: 1 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: world2shift
spec:
containers:
- name: nginx
image: nginxinc/nginx-unprivileged:1.16
ports:
- containerPort: 8080
volumeMounts:
- name: config-volume
mountPath: /usr/share/nginx/html/index.html
subPath: index.html
volumes:
- name: config-volume
configMap:
name: world2shift-config
---
apiVersion: v1
kind: Service
metadata:
name: world2shift-service
labels:
app: world2shift
spec:
ports:
- port: 8080
selector:
app: world2shift
---
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: world2shift-route
labels:
app: world2shift
spec:
to:
kind: Service
name: world2shift-service
weight: 100
port:
targetPort: 8080
wildcardPolicy: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment