Skip to content

Instantly share code, notes, and snippets.

@naioja
Created August 25, 2022 09:37
Show Gist options
  • Save naioja/eafe7df28c4df6482c624a3f78b73572 to your computer and use it in GitHub Desktop.
Save naioja/eafe7df28c4df6482c624a3f78b73572 to your computer and use it in GitHub Desktop.
---
apiVersion: v1
kind: Namespace
metadata:
name: nginx
---
apiVersion: v1
kind: ResourceQuota
metadata:
name: ns-resource-quota
namespace: nginx
spec:
hard:
requests.cpu: "10"
requests.memory: 4Gi
limits.cpu: "15"
limits.memory: 8Gi
pods: "50"
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: nginx
name: myapp
labels:
app: myapp
spec:
replicas: 3
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: nginx:1.7.9
ports:
- containerPort: 80
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
periodSeconds: 5
resources:
requests:
cpu: 250m
memory: 128Mi
limits:
cpu: 750m
memory: 256Mi
tolerations:
- key: "WORKLOAD"
operator: "Equal"
value: "TEST"
effect: "NoSchedule"
nodeSelector:
"kubernetes.io/os": linux
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: agentpool
operator: In
values:
- usernp001
---
apiVersion: v1
kind: Service
metadata:
name: myapp
namespace: nginx
spec:
selector:
app: myapp
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: myapp-pdb
namespace: nginx
spec:
minAvailable: 3
selector:
matchLabels:
app: myapp
---
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: myapp-hpa
namespace: nginx
spec:
maxReplicas: 20
minReplicas: 3
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: myapp
targetCPUUtilizationPercentage: 5 # target CPU utilization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment