Thursday, January 23, 2025

OpenShift - Scaling and Autoscaling - Part 4

 

Scaling and Autoscaling:

Horizontal scaling adds more machines into the system while vertical scaling add more resources to existing system.




#oc scale dc/name --replica=<number>
Monitoring the pod:
#oc adm top pods
#oc get events
Autoscaling:
It will increase the CPU and memory depends upon the requirement by automatically.
#oc autoscale dc/<name> --min=3 --max=6 --cpu-limit=60

List the information about the project:
#oc describe project projectname

Patching the Pod:
#oc patch dc/<name> -p '{"spec":{"template":{"spec":{"containers":{"image":"quay.io/existimage/newimage"}}}}}'

Secret and configMap:
Secrets is a encrypted data (Sensitive information)
configMap is a plain text (hostname, ceritificate)

Secret types:
1) Generic 
2) TLS (SSL)
3)docker-cfg

secret is using a base64 format encreption method.

Decode the secret file
#base64 --decode secretfile

List the secret
#oc get secret
#oc set env dc/mytest --from=secret/mytest-secret

Login into Pod:
#oc exec -it podname -- bash

#oc get pod -o yaml | grep -i scc
#oc get pod podname -o yaml | oc adm scc-subject-review -f -
#oc adm policy add-scc-to-user username
#oc adm policy remove-scc-to-uesr username

Templete is not found Error:
#oc login -u kubeadmin -p $(cat /usr/local/etc/kube-admin-password) https://api.example.com:6443
#oc edit projects.config.openshift.io 
Removed projectRequestTemplete & name parameter and place a empty {} 

No comments:

Post a Comment