Skip to content

Instantly share code, notes, and snippets.

@smijar
Created January 17, 2023 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smijar/442f87791b0e94d434b897b20fab7054 to your computer and use it in GitHub Desktop.
Save smijar/442f87791b0e94d434b897b20fab7054 to your computer and use it in GitHub Desktop.
# To deploy: kubectl apply -f nginx-hello-world-deployment.yaml
# Access it with the API as a proxy:
# $ kubectl proxy
# Then in your browser: http://localhost:8001/api/v1/namespaces/default/services/nginx:/proxy/#!/
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30001
selector:
app: nginx
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
data:
nginx.conf: '
events {
}
http {
server {
listen 80;
location / {
return 200 "Hello world!";
}
}
}
'
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
strategy:
type: Recreate
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: nginx:latest
name: nginx
ports:
- containerPort: 80
name: web
volumeMounts:
- name: config-vol
mountPath: /etc/nginx/
volumes:
- name: config-vol
configMap:
name: nginx-config
items:
- key: nginx.conf
path: nginx.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment