Skip to content

Instantly share code, notes, and snippets.

@MohammadTofic-prog
Created February 27, 2025 06:52
Show Gist options
  • Save MohammadTofic-prog/28184e2d400c41bcb0d9870afc3b3bc2 to your computer and use it in GitHub Desktop.
Save MohammadTofic-prog/28184e2d400c41bcb0d9870afc3b3bc2 to your computer and use it in GitHub Desktop.
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
labels:
app: hello-world
spec:
replicas: 1
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
containers:
- name: hello-world
image: nginx:alpine # Using nginx as a simple HTTP server
ports:
- containerPort: 8080
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
volumes:
- name: nginx-config
configMap:
name: nginx-config
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
data:
default.conf: |
server {
listen 8080;
server_name localhost;
location / {
return 200 'Hello World';
add_header Content-Type text/plain;
}
}
---
apiVersion: v1
kind: Service
metadata:
name: hello-world
spec:
selector:
app: hello-world
ports:
- port: 8080
targetPort: 8080
nodePort: 30001
type: NodePort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment