Optimizing Developer Self-Service in OpenShift/Kubernetes

Optimizing Developer Self-Service in OpenShift/Kubernetes

In many case organizations crate the OpenShift cluster and handover to the developer teams. But the cluster running on prams or clouds has limit amount of resources. We have finite resources, and don’t have infinite resources. So utilization of resources is extremely important.

For an example we created a pod and inside the pod we are running X number of containers. In this case pod and container both consume resources. The major resource consumption happened on container level. Minimal resource consumption by pod which is call pod overhead, but it is very minimal or negligible.

When we deploy a ymal file, it is optional for us to define the resources. The default value is unlimited which means that as much as resources required it can be used by application.

So, as an Administrator we want to make sure that, we an app will deployed it will take minimum resources and can’t cross the maximum resources which is called as limit range. This is the Kubernetes concept it’s not an OpenShift concept.

Limit range allow us to define the default settings, in case of developer don’t define the how much resource will consume then the default limit range will be applicable.

We can start with default requested, default requested means if the developer do not define how much resource container will receive when it is start then the value will be used.

Then we have default limit, default means the maximum resource container can be consume.

But if the developer define the very high CPU or memory manually then the container  will the with this resources. To minimize this issue we can define the minimum and maximum resource so that the container can’t cross the maximum or minimum limit.  

 

Example of Limit Range yaml:

On a project label we can also use quota. Limit range is defining how much resource can using Container/Pod and Quota will defining how much can consuming in total project.  For  creating quota we can use below command:

oc create quota my-quota –hard=cpu=2,memory=1G,pods=3,services=6,replicationcontrollers=6,secrets=6

 

limit range, quota, default request all are come from Kubernetes so what is offering the OpenShift?

OpenShift offering two major advantages: Cluster Resource Quota and Project Bootstrap template.

 

Cluster Resource Quota: cluster resource quota can apply on multiple project at a time and it will also work for future quota. For this we can use label. For crate quota with label we can use below command

oc create clusterresourcequota my-crq –hard memory=1Gi,cpu=1,pods=10,secrects=10,services=3 –project-label-selector app=one

in future the project which have label app=one will automatically apply this quota.

 

Project Bootstrap template: when we try to create new project, the request goes to OpenShift API server, API server use Project Bootstrap template which is file which has information about when new project will create which configuration the project will get. We can modify the Project Bootstrap template as required. We can add the quota and limit range in Project Bootstrap template. When ever a new project will create it will automatically apply this quota and limit range. For creating the Project Bootstrap template we can use below commad:

oc adm create-bootstrap-project-template -o yaml> template.yaml

After Creating the template we need to modify the template. Before the parameters we need to added Quota. For an example like this

After Creating the template we need to modify the template. Before the parameters we need to added Limit Range. For an example like this

Now we need to apply the template to our cluster. For apply we can use below command:

oc apply -f template.yaml -n oepnshift-config

After applying the command collect the template name. This is important.

Now we need to identify our cluster name. for this we can use below command.

oc get projects.config

after getting the cluster name we need to edit the configuration file. For edit we need to use below command

oc edit projects.config cluster

In the yaml file after the spec we need to add our template name which we collect before.

#Leave A Comment

#About Author

Shaokat Ullaha

Expert in VMware | Red Hat| Backup | Storage Solutions

Author of this blog Shaokat Ullaha is professional in IT filed, Specialist in VMware, Cloud Solutions, DevOps, Backup and Digester Recovery

#Categories

#Follow Me

SUBSCRIBE TO RACHEL MOOR BLOG


    #Recent Post

    #Leave A Comment

    single-post-travel-03

    Subscribe To Newsletter

    Get Notification of each & every new blogs through your e-mail


      This is a blog platform where I share my personal experiences and insights, encouraging others to share theirs as well so we can learn from each other and grow together

      #Instagram

      #Contact With Me

      +8801973111031