Kubernetes Objects
Overview
- Kubernetes uses objects to represent state of cluster.
- What containerized applications are running (and on which node)
- The policies around how those applications behave, such as restart policies, upgrade and fault tolerance.
- Once you create the object the Cuba Reddy system will constantly work to ensure that object exists and maintain cluster's desired state
- Every Kubernetes object include two nested fields that govern the object conflguration and they are - Object Specification and the Object status.
- The specification, which we provide describes your desired state for the object- the characteristics that you want the object to have
- The status describes the actual state of the object and is supplied and updated by the Kubernetes system
- All objects are identified by a unique name and a UID
Basic Kubernets Objects
The basic humanities objects include -
- Pod
- Service
- Volume
- Namespaces
- Replicaset
- Secrets
- ConfigMaps
- Deployments
- Jobs
- Darmonsets
There are more than 200 Kubernetes objects.
Relationship between the objects
- Pod manages containers
- Replica set manages pods
- services expose pod processes to the outside world
- Configmaps and Secrets helps you configure pod
Representation
- It represents as JSON or YAML file.
- You create these and then push them to the Kubernetes API with
kubectl
State of the object
Replicas (2/2)
- Image (Tomcat/Ubuntu)
- Name
- Port
- Volume
- Startup
- Detached
Kubernetes object management
- The
kubectl
command line to support several different ways to create and manage kubernetes object
Management Technique | Operates On | Recommended Environment |
---|---|---|
Imperative Command (Creating and working directly using command) | Live objects | Development/Testing |
Declarative Object Configuration | Individual files (YAML/JSON) | Production |
Declarative is about describing what you are trying to achieve, without instructing how to do it.
Imperative explicitly tells "how to accomplish it.