Skip to main content

Installing CPA

In this lab exercise, we'll be installing CPA using Kustomize manifests, the main part of which is the Deployment resource below:

~/environment/eks-workshop/modules/autoscaling/workloads/cpa/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: dns-autoscaler
namespace: other
labels:
k8s-app: dns-autoscaler
kubernetes.io/cluster-service: "true"
spec:
selector:
matchLabels:
k8s-app: dns-autoscaler
template:
metadata:
labels:
k8s-app: dns-autoscaler
spec:
securityContext:
seccompProfile:
type: RuntimeDefault
supplementalGroups: [ 65534 ]
fsGroup: 65534
nodeSelector:
kubernetes.io/os: linux
containers:
- name: autoscaler
image: registry.k8s.io/cpa/cluster-proportional-autoscaler:1.8.5
resources:
requests:
cpu: "20m"
memory: "10Mi"
command:
- /cluster-proportional-autoscaler
- --namespace=kube-system
- --configmap=dns-autoscaler
- --target=Deployment/coredns
- --default-params={"linear":{"nodesPerReplica":2,"min":2,"max":6,"preventSinglePointFailure":true,"includeUnschedulableNodes":true}}
- --logtostderr=true
- --v=2
tolerations:
- key: "CriticalAddonsOnly"
operator: "Exists"
serviceAccountName: dns-autoscaler

Let's apply this to our cluster:

~$kubectl apply -k ~/environment/eks-workshop/modules/autoscaling/workloads/cpa

This will create a Deployment in the kube-system namespace which we can inspect:

~$kubectl get deployment dns-autoscaler -n other
NAME             READY   UP-TO-DATE   AVAILABLE   AGE
dns-autoscaler   1/1     1            1           10s

After CPA starts up it will automatically create a ConfigMap we can modify to adjust its configuration:

~$kubectl describe configmap dns-autoscaler -n kube-system
Name:         dns-autoscaler
Namespace:    other
Labels:       <none>
Annotations:  <none>
Data
====
linear:
----
{'coresPerReplica':2,'includeUnschedulableNodes':true,'nodesPerReplica':1,'preventSinglePointFailure':true,'min':1,'max':4}
Events:  <none>