Skip to content

Instantly share code, notes, and snippets.

@gowatana
Created September 18, 2020 19:41
Show Gist options
  • Save gowatana/d52320cae4e4a4bf3372fbdbccb01151 to your computer and use it in GitHub Desktop.
Save gowatana/d52320cae4e4a4bf3372fbdbccb01151 to your computer and use it in GitHub Desktop.
---
kind: Service
apiVersion: v1
metadata:
name: web-svc
spec:
type: LoadBalancer
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: demo-httpd
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: demo-httpd
labels:
app: web
spec:
replicas: 2
selector:
matchLabels:
app: demo-httpd
template:
metadata:
labels:
app: demo-httpd
spec:
containers:
- name: httpd
image: gowatana/centos7:httpd
ports:
- containerPort: 80
protocol: TCP
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- demo-httpd
topologyKey: "kubernetes.io/hostname"
@gowatana
Copy link
Author

gowatana commented Sep 18, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment