Skip to content

Instantly share code, notes, and snippets.

@chendotjs
Last active December 2, 2020 07:00
Show Gist options
  • Save chendotjs/3bd6d9ba00ab9357cfbb8210060d743a to your computer and use it in GitHub Desktop.
Save chendotjs/3bd6d9ba00ab9357cfbb8210060d743a to your computer and use it in GitHub Desktop.
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
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: py-simple-http
image: frolvlad/alpine-python2:latest
imagePullPolicy: IfNotPresent
command: ["/bin/sh"]
args:
[
"-c",
'echo "<p>Hello from $(hostname)</p>" > index.html; python -c "import socket,SocketServer,CGIHTTPServer;SocketServer.TCPServer.address_family=socket.AF_INET6;CGIHTTPServer.test()" 8080',
]
ports:
- name: http
containerPort: 8080
terminationGracePeriodSeconds: 0
---
kind: Service
apiVersion: v1
metadata:
name: simple-http-clusterip
spec:
type: ClusterIP
selector:
app: simple-http
ports:
- port: 80
targetPort: 8080
---
kind: Service
apiVersion: v1
metadata:
name: simple-http-nodeport
spec:
type: NodePort
selector:
app: simple-http
ports:
- port: 80
targetPort: 8080
---
kind: Service
apiVersion: v1
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