Scaling up and down the application or service based on predefined criteria is a common way to utilize the most compute resources in most efficient way. In Kubernetes, you can scale up and down manually or use a Horizontal Pod Autoscaler (HPA) to do autoscaling. In this section, we'll describe how to perform both operations.
Scaling your containers
Getting ready
Prepare the following YAML file, which is a simple Deployment that launches two nginx containers. Also, a NodePort service with TCP—30080 exposed:
# cat 3-1-1_deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx
spec:
replicas: 2
selector:
matchLabels:
service : nginx
template:
metadata:
labels:
service :...