Last active
July 24, 2025 13:19
-
-
Save chendotjs/3bd6d9ba00ab9357cfbb8210060d743a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: Deployment | |
apiVersion: apps/v1 | |
metadata: | |
name: simple-http | |
spec: | |
replicas: 2 | |
selector: | |
matchLabels: | |
app: simple-http | |
template: | |
metadata: | |
labels: | |
app: simple-http | |
spec: | |
containers: | |
- name: nginx-simple-http | |
image: nginx:1.19 | |
imagePullPolicy: IfNotPresent | |
command: ["/bin/sh"] | |
args: | |
[ | |
"-c", | |
'echo "<p>Hello from nginx $(hostname)</p>" > /usr/share/nginx/html/index.html; nginx -g "daemon off;"', | |
] | |
ports: | |
- name: http | |
containerPort: 80 | |
terminationGracePeriodSeconds: 0 | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: simple-http-clusterip | |
spec: | |
type: ClusterIP | |
selector: | |
app: simple-http | |
ports: | |
- port: 80 | |
targetPort: 80 | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: simple-http-nodeport | |
spec: | |
type: NodePort | |
selector: | |
app: simple-http | |
ports: | |
- port: 80 | |
targetPort: 80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: simple-http | |
spec: | |
replicas: 2 | |
selector: | |
matchLabels: | |
app: simple-http | |
template: | |
metadata: | |
labels: | |
app: simple-http | |
spec: | |
containers: | |
- name: py-simple-http | |
image: python:3.9-slim | |
imagePullPolicy: IfNotPresent | |
command: ["/bin/sh"] | |
args: | |
- -c | |
- | | |
echo "<p>Hello from $(hostname)</p>" > index.html | |
python3 -m http.server 8080 | |
ports: | |
- name: http | |
containerPort: 8080 | |
terminationGracePeriodSeconds: 0 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: simple-http-clusterip | |
spec: | |
type: ClusterIP | |
selector: | |
app: simple-http | |
ports: | |
- port: 80 | |
targetPort: 8080 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: simple-http-nodeport | |
spec: | |
type: NodePort | |
selector: | |
app: simple-http | |
ports: | |
- port: 80 | |
targetPort: 8080 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: simple-http-lb | |
spec: | |
type: LoadBalancer | |
selector: | |
app: simple-http | |
ports: | |
- port: 80 | |
targetPort: 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment