The Horizontal Pod Autoscaler automatically scales the number of Pods in a replication controller, deployment, replica set or stateful set based on observed CPU utilization (or, with custom metrics support, on some other application-provided metrics). Note that Horizontal Pod Autoscaling does not apply to objects that can't be scaled, for example, DaemonSets.
1. Create a Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deploy
labels:
app: nginx-app
spec:
replicas: 1
template:
metadata:
labels:
app: nginx-app
spec:
serviceAccountName: appsa
containers:
- name: nginx-container
image: nginx:1.7.9
ports:
- containerPort: 80
resources:
limits:
cpu: 50m
requests:
cpu: 50m
selector:
matchLabels:
app: nginx-app
---
apiVersion: v1
kind: Service
metadata:
name: my-service
labels:
app: nginx-app
spec:
selector:
app: nginx-app
type: NodePort
ports:
- nodePort: 31111
port: 80
targetPort: 80
Comments
Post a Comment