Skip to content

Instantly share code, notes, and snippets.

@pre
Last active September 5, 2022 06:08
Show Gist options
  • Save pre/2ca8e121a4b6330cd2cae92def3566b1 to your computer and use it in GitHub Desktop.
Save pre/2ca8e121a4b6330cd2cae92def3566b1 to your computer and use it in GitHub Desktop.
k8s nginx hello world manifest
---
apiVersion: v1
kind: Namespace
metadata:
name: hello-1
---
apiVersion: v1
kind: Service
metadata:
name: hello-1
namespace: hello-1
spec:
type: ClusterIP
ports:
- port: 80
targetPort: http
protocol: TCP
name: http
selector:
app: hello-1
---
apiVersion: v1
kind: ConfigMap
metadata:
name: example-content
namespace: hello-1
data:
index.html: |
hello-1
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: hello-1
name: hello-1
namespace: hello-1
spec:
replicas: 1
selector:
matchLabels:
app: hello-1
template:
metadata:
labels:
app: hello-1
spec:
containers:
- image: nginx:latest
name: nginx
ports:
- name: http
containerPort: 80
volumeMounts:
- name: example-content
mountPath: /usr/share/nginx/html/index.html
subPath: index.html
- name: example-content
mountPath: /usr/share/nginx/html/hello-1.html
subPath: hello-1.html
volumes:
- name: example-content
configMap:
name: example-content
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: nginx
namespace: hello-1
spec:
gateways:
- istio-system/default-gateway
hosts:
- '*.example.com'
http:
- match:
- uri:
prefix: /
route:
- destination:
host: hello-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment