Skip to content

Instantly share code, notes, and snippets.

@mbaykara
Created September 25, 2022 21:10
Show Gist options
  • Select an option

  • Save mbaykara/73b7ccd8171b69a87b40ed22ec9a8664 to your computer and use it in GitHub Desktop.

Select an option

Save mbaykara/73b7ccd8171b69a87b40ed22ec9a8664 to your computer and use it in GitHub Desktop.
apiVersion: apps/v1
kind: Deployment
metadata:
name: sample-app
labels:
app: sample-app
spec:
selector:
matchLabels:
app: sample-app
template:
metadata:
labels:
app: sample-app
spec:
containers:
- image: nginx:alpine
name: nginx
ports:
- containerPort: 80
name: http
volumeMounts:
- mountPath: /usr/share/nginx/html/index.html
subPath: index.html
name: index-html
resources:
requests:
cpu: 50m
memory: 50m
limits:
cpu: 100m
memory: 100Mi
volumes:
- name: index-html
configMap:
name: index-html
defaultMode: 0777
---
apiVersion: v1
kind: ConfigMap
metadata:
name: index-html
data:
index.html: |-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello!</title>
</head>
<body>
<h1>Sample App is runnig ...</h1>
<p>This is a simple paragraph.</p>
</body>
</html
---
apiVersion: v1
kind: Service
metadata:
name: sample-app
spec:
selector:
app: sample-app
ports:
- port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: traefik
name: sample-app
spec:
rules:
- host: sample.app.com
http:
paths:
- backend:
service:
name: sample-app
port:
number: 80
path: /
pathType: ImplementationSpecific
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment