Skip to content

Instantly share code, notes, and snippets.

@tass-lin
Created December 4, 2019 02:03
Show Gist options
  • Select an option

  • Save tass-lin/f036242df000db087076571adeef7818 to your computer and use it in GitHub Desktop.

Select an option

Save tass-lin/f036242df000db087076571adeef7818 to your computer and use it in GitHub Desktop.
kubernetes yaml
apiVersion: v1
kind: Namespace
metadata:
name: _APP_NAMESPACE_
---
kind: Service
apiVersion: v1
metadata:
name: _APP_NAME_
namespace: _APP_NAMESPACE_
annotations:
service.beta.kubernetes.io/aws-load-balancer-type: nlb
spec:
type: LoadBalancer #LoadBalancer NodePort ClusterIp
selector:
name: _APP_NAME_
ports:
- port: 80
targetPort: 8080
protocol: TCP
name: http
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: _APP_NAME_
namespace: _APP_NAMESPACE_
spec:
selector:
matchLabels:
name: _APP_NAME_
replicas: 1
template:
metadata:
labels:
name: _APP_NAME_
spec:
containers:
- name: _APP_NAME_
image: _CONTAINER_IMAGE_
imagePullPolicy: Always
ports:
- containerPort: 80
resources:
requests:
cpu: 256m
memory: 256Mi
limits:
cpu: 512m
memory: 512Mi
---
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: _APP_NAME_
namespace: _APP_NAMESPACE_
spec:
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Deployment
name: _APP_NAME_
minReplicas: 1
maxReplicas: 2
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 60
- type: Resource
resource:
name: memory
targetAverageUtilization: 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment