Skip to content

quickbooks2018/eks-karpenter

Repository files navigation

KARPENTER Installation updated repo "USE THIS" https://github.com/quickbooks2018/aws-eks-blueprints.git

Backend

S3
Create S3 Bucket with Versioning enabled
aws s3api create-bucket --bucket cloudgeeks-terraform --region us-east-1

aws s3api put-bucket-versioning --bucket cloudgeeks-terraform --versioning-configuration Status=Enabled
Key Pair
if [ -d /root/.ssh ]
then
echo "/root/.ssh exists"
else
mkdir -p /root/.ssh
fi

if [ -f /root/.ssh/*.pem ]
then
echo "pem is there, I am removing it"
rm -f ~/.ssh/*.pem
export SSH_KEY_NAME="terraform-cloudgeeks"
aws ec2 create-key-pair --key-name "${SSH_KEY_NAME}" --query 'KeyMaterial' --output text > ~/.ssh/${SSH_KEY_NAME}.pem
else
echo "All is well, now I am creating fresh PEM"
export SSH_KEY_NAME="terraform-cloudgeeks"
aws ec2 create-key-pair --key-name "${SSH_KEY_NAME}" --query 'KeyMaterial' --output text > ~/.ssh/${SSH_KEY_NAME}.pem
fi
KubeConfig
if [ -d /root/.kube ]
then
echo "/root.kube directory exists"
else
mkdir /root/.kube && touch /root/.kube/config
fi
Source
source EKS.env
Karpenter Logs
kubectl logs -f -n karpenter $(kubectl get pods -n karpenter -l karpenter=controller -o name)
  • Create Deployment
kubectl create deployment <Deplyment-Name> --image=<Container-Image>
kubectl create deployment first-deployment --image=quickbooks2018/blue:latest
  • Scale Deployment
kubectl scale --replicas=20 deployment/<Deployment-Name>
kubectl scale --replicas=20 deployment/first-deployment 
Metrics Server Installation
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
Metrics-server
kubectl get deployment metrics-server -n kube-system

kubectl get pods -n kube-system -l k8s-app=metrics-server
Load Testing
  1. To create a php-apache deployment, run the following command:
kubectl create deployment php-apache --image=k8s.gcr.io/hpa-example
  1. To set the CPU requests, run the following command:
kubectl patch deployment php-apache -p='{"spec":{"template":{"spec":{"containers":[{"name":"hpa-example","resources":{"requests":{"cpu":"200m"}}}]}}}}'
  1. To expose the deployment as a service, run the following command:
kubectl create service clusterip php-apache --tcp=80
  1. To create an HPA, run the following command:
kubectl autoscale deployment php-apache --cpu-percent=50 --min=1 --max=10
  1. To confirm that the HPA was created, run the following command:
kubectl get hpa

 kubectl describe hpa
  1. To test a load on the pod in the namespace that you used in step 1, run the following:
kubectl run -i --tty load-generator --rm --image=busybox --restart=Never -- /bin/sh -c "while sleep 0.01; do wget -q -O- http://php-apache; done"
  1. Script:
    
while sleep 0.01; do wget -q -O- http://php-apache; done
  1. To see how the HPA scales the pod based on CPU utilization metrics, run the following command (preferably from another terminal window)
kubectl get hpa -w
  1. To clean up the resources used for testing the HPA, run the following commands:
kubectl delete hpa,service,deployment php-apache
kubectl delete pod load-generator
  • kubectl top
kubectl top --help

kubectl top node

kubectl top pod -A

kubectl top pod --containers -A

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages