Last active
April 25, 2020 12:46
-
-
Save TrongTan124/84eea382a65788f47a915267fd60dc42 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 | |
kind: Deployment | |
metadata: | |
name: frontend | |
labels: | |
app: tannt-myapp | |
role: frontend | |
spec: | |
selector: | |
matchLabels: | |
app: tannt-myapp | |
role: frontend | |
template: # create pods using pod definition in this template | |
metadata: | |
labels: | |
app: tannt-myapp | |
role: frontend | |
spec: | |
containers: | |
- name: nginx | |
image: nginx | |
ports: | |
- containerPort: 80 | |
resources: | |
limits: | |
cpu: "200m" | |
memory: "200Mi" | |
--- | |
apiVersion: autoscaling/v2beta1 | |
kind: HorizontalPodAutoscaler | |
metadata: | |
name: hpa-frontend | |
namespace: default | |
spec: | |
scaleTargetRef: | |
apiVersion: apps/v1 | |
kind: Deployment | |
name: frontend | |
minReplicas: 3 | |
maxReplicas: 10 | |
metrics: | |
- type: Resource | |
resource: | |
name: memory | |
targetAverageUtilization: 80 | |
- type: Resource | |
resource: | |
name: cpu | |
targetAverageUtilization: 3 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: my-service | |
# namespace: ingress-nginx | |
spec: | |
type: NodePort | |
ports: | |
- name: http | |
protocol: TCP | |
port: 80 | |
targetPort: 80 | |
nodePort: 30080 | |
selector: | |
app: tannt-myapp | |
role: frontend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment