Skip to content

Instantly share code, notes, and snippets.

@muff1nman
Created March 10, 2020 20:12
Show Gist options
  • Save muff1nman/75d5c5c1f896aa479a32d7dfd69fc9b7 to your computer and use it in GitHub Desktop.
Save muff1nman/75d5c5c1f896aa479a32d7dfd69fc9b7 to your computer and use it in GitHub Desktop.
---
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-sites
labels:
app: nginx
role: site
data:
index.html: |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>${USER}</title>
<link rel="icon" href="http://raw.githubusercontent.com/mattalberts/k8s-101/master/site/terminal-icon.png" type="image/png" sizes="16x16">
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?skin=desert"></script>
</head>
<body>
<pre class="prettyprint lang-bash">
<code>
# Clean Up!
:~ ${USER}$ kubectl delete -f nginx.yaml
</code>
</pre>
</body>
</html>
---
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
role: address
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
labels:
app: nginx
role: site
spec:
replicas: 1
selector:
matchLabels:
app: nginx
role: site
template:
metadata:
labels:
app: nginx
role: site
spec:
containers:
- name: nginx
image: nginx:1.15.7
ports:
- containerPort: 80
volumeMounts:
- name: shared-data
mountPath: /usr/share/nginx/html
resources:
limits:
cpu: 100m
memory: 32Mi
terminationGracePeriodSeconds: 60
volumes:
- name: shared-data
configMap:
name: nginx-sites
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-ingress
labels:
app: nginx
role: access
spec:
podSelector: {}
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
app.pyli.cfplat.com/name: ingress-system
ports:
- protocol: TCP
port: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx
labels:
app: nginx
role: route
annotations:
kubernetes.io/ingress.class: contour
spec:
rules:
- host: ${USER}.ing.pdx-a.k8s.cfplat.com
http:
paths:
- path: /
backend:
serviceName: nginx
servicePort: 80
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment