diff --git a/README.md b/README.md index e69de29..e32bfde 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,3 @@ +# DOCS + +https://notes.leskientz.ovh/doc/k3s-installation-deploiement-auto-scaling-ORYYqZiQPb diff --git a/deployment.yaml b/deployment.yaml new file mode 100644 index 0000000..160b726 --- /dev/null +++ b/deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: web +spec: + replicas: 1 + selector: + matchLabels: + app: web + template: + metadata: + labels: + app: web + spec: + containers: + - name: web + image: nginx + resources: + requests: + cpu: "100m" + limits: + cpu: "500m" diff --git a/hpa.yaml b/hpa.yaml new file mode 100644 index 0000000..71f7b15 --- /dev/null +++ b/hpa.yaml @@ -0,0 +1,18 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: web-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: web + minReplicas: 1 + maxReplicas: 5 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 50 diff --git a/ingress.yaml b/ingress.yaml new file mode 100644 index 0000000..64726c1 --- /dev/null +++ b/ingress.yaml @@ -0,0 +1,16 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: web +spec: + rules: + - host: web.local + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: web + port: + number: 80 diff --git a/service.yaml b/service.yaml new file mode 100644 index 0000000..56c6121 --- /dev/null +++ b/service.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: web +spec: + selector: + app: web + ports: + - port: 80 + targetPort: 80