Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save massifaqiri/9941c87666a596a92d4d659ce29fb5ef to your computer and use it in GitHub Desktop.
Save massifaqiri/9941c87666a596a92d4d659ce29fb5ef to your computer and use it in GitHub Desktop.
kind: Service
apiVersion: v1
metadata:
name: train-schedule-service
spec:
type: NodePort
selector:
app: train-schedule
ports:
- protocol: TCP
port: 8080
nodePort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: train-schedule-deployment
labels:
app: train-schedule
spec:
replicas: 2
selector:
matchLabels:
app: train-schedule
template:
metadata:
labels:
app: train-schedule
spec:
containers:
- name: train-schedule
image: linuxacademycontent/train-schedule:autoscaling
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 15
timeoutSeconds: 1
periodSeconds: 10
resources:
requests:
cpu: 200m
---
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: train-schedule
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: train-schedule-deployment
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment