Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Kubernetes Custom Resources with Oops Concept

Kubernetes custom resources (CRs) are extensions of the Kubernetes API that allow you to define your own resources. CRs can be used to represent anything that you want to manage in Kubernetes, such as applications, services, or infrastructure.

The oops concept in Kubernetes refers to the idea of using custom resources to represent objects that are not natively supported by Kubernetes. For example, you could use a custom resource to represent a database or a server.

There are a few benefits to using custom resources with the oops concept:

  • You can define your own resources to represent the specific objects that you need to manage.
  • You can use custom resources to extend the functionality of Kubernetes.
  • You can use custom resources to make your Kubernetes deployments more declarative.

To use custom resources with the oops concept, you need to:

  1. Create a custom resource definition (CRD).
  2. Create instances of the custom resource.
  3. Use the custom resource in your Kubernetes manifests.

The CRD defines the schema for the custom resource. The schema specifies the name, type, and properties of the custom resource.

The instances of the custom resource represent the actual objects that you want to manage. You can create instances of the custom resource using the kubectl create command.

The custom resource can be used in your Kubernetes manifests to define how the object should be managed. For example, you can use the custom resource to define the desired state of the object or to define the resources that the object should consume.

Kubernetes Custom Resources and OOP Concepts

**1. Class as Custom Resource Definition (CRD):

In Object-Oriented Programming, a class is a blueprint for creating objects with attributes (properties) and behaviors (methods). Similarly, a Custom Resource Definition (CRD) in Kubernetes serves as a blueprint for creating Custom Resources. Just as a class defines the structure and behavior of objects, a CRD defines the structure and behavior of your Custom Resource instances.

**2. Object as Custom Resource Instance:

In OOP, an object is an instance of a class, representing a concrete entity with specific properties and behaviors. In Kubernetes, a Custom Resource Instance (CRI) is an instance of a Custom Resource defined by a CRD. It encapsulates data and configuration relevant to a specific use case or application, much like an object encapsulates attributes and methods.

**3. Inheritance and Composition:

OOP concepts often include inheritance and composition. Similarly, Kubernetes CRDs allow you to define relationships and compositions between different Custom Resources. You can create hierarchies of CRDs, enabling the reuse of common properties and behaviors across multiple CRIs.

**4. Methods as Controllers:

In OOP, methods define the behaviors that objects can perform. In Kubernetes, Controllers define the desired behavior of Custom Resources. Controllers watch for changes in CRIs and manage their lifecycle, ensuring that the defined behavior and desired state are maintained, just as methods enforce behavior on objects.

**5. Polymorphism and Extension:

OOP emphasizes polymorphism, where different objects can respond to the same method call in different ways. Similarly, in Kubernetes, different CRIs based on the same CRD can have different behaviors enforced by their respective Controllers. This flexibility enables extension and customization of behavior based on specific needs.

**6. Namespaces as Encapsulation:

In OOP, namespaces and packages help encapsulate and organize classes. In Kubernetes, namespaces serve a similar purpose by providing isolation and organization for Custom Resources. Namespaces prevent naming conflicts and allow you to logically group related CRIs.

**7. Instance Methods and Attributes:

In OOP, instance methods and attributes belong to specific objects. In Kubernetes, the data within a Custom Resource Instance and the behaviors enforced by its Controller are tied together, just as instance methods and attributes are associated with specific objects.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

List of containerized storage orchestration in Kubernetes

List of Containerized Storage Orchestration Solutions in Kubernetes (2026 Edition) Kubernetes has become excellent at orchestrating stateless applications, but stateful workloads still need a proper storage layer….

Read More

Understanding Authentication & Authorization in kubernetes

Authentication – How User’s access should be allowed? The process or action of verifying the identity of a user or process.Authorization – What Access and till what…

Read More

Kubernetes 1.23.6 Cluster Setup Master and Worker in Ubuntu 20.04

Latest doc – https://github.com/certifications-tutorials/kubernetes-cluster-setup Following commands would help you to create 1 Master and 1 Node in same VM. Run Following commands in Master Node Run following…

Read More

Kubernetes PersistentVolume, PersistentVolumeClaim, volume using hostPath

pv.yaml $ kubectl create -f pv.yaml $ kubectl get pv pvc.yaml $ kubectl create -f pvc.yaml $ kubectl get pvc pod.yaml Rajesh Kumar I’m a DevOps/SRE/DevSecOps/Cloud Expert…

Read More

Kubernetes: Working with ReplicationController

A ReplicationController is a Kubernetes controller that ensures that a specified number of pod replicas are running at any one time. In other words, a ReplicationController makes…

Read More

Kubernetes Tutorials: Pod Load balancing using Service

In Kubernetes, a Service is an abstraction that defines a logical set of pods and a policy by which to access them. It provides a stable network…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x