Kubernetes A Winning Container War
Posted By : Ankit Arora | 26-Jun-2017
Kubernetes
Open source tool to manage containers with easy management & discovery.
For automating deployment, scaling & management.
- Greek word “Pilot”.
Schedules, runs & manages containers in a cluster of virtual or physical machines.- Started by Google in 2014
- 100% Open Source.
- Written in GO.
Basic components/features of Kubernetes:-
#1 PODs
- Smallest deployable unit
- Group of tightly coupled containers
- Shared network & data volumes.
- Routable IP.
- Mortal.
#2 ReplicaSets
- Run x copies(replica) of a pod.
- Can start or kill pods if necessary.
- Handle pod failures using health checks.
#3 Deployments
- Contains declarations of our application
- Which container(image/tag).
- Environment variables.
- Data volumes.
- Defines no. of replicas.
- Creates replicaSet which in turn create pods.
#4 Services
- Service provides a permanent virtual IP & DNS to Pods.
- Proxy traffic to selected pods.
- Simple load balancing.
#5 NameSpaces
- Combination/Group of K8s resources(pods,
replicasets , deployments,etc.) - By
default everything is in “default” namespace. - Can create namespaces for environments(test,staging,production,etc.)
- Restrict access to specific namespaces for k8s users.
- Namespaces can have
sepearated network(just like VPC in AWS.)
#6 Clusters
Cluster is a set of virtual or physical machines(nodes).- Runs as k8s master & one or more k8s workers nodes.
- Cluster Federation:
- Runs a federation master, which knows all your clusters
- Run
you apps distributed across clusters eg. AWS/Google regions.
#7 Secrets & ConfigMaps
- Separate your application code & configuration.
- Both secrets & ConfigMaps are key-value-pairs.
- Use secret for binary values(e.g.certificates,keys).
- Use ConfigMaps for string values.
- Both can be read by the container via environment variables or mapped into a data volumes e.g. Like poperty file.
#8 Data Volumes
- Map directories into containers.
- Multiples containers in one
pods shares the same volume. - Many volume types:
- NFS
- GPD
- AWS Block Storage.
- Etc.
- Can be preconfigured by cluster admins for easier usage by cluster users.
#9 PetSets
- A
Petset is a stateful pod. - A PetSet has a scalable no. of pets.
- A pet is bound to a dynamically created data volume.
- That data volume will never be deleted automatically.
- Pet is bound to the same volume on a restart.
#10 Jobs
- Used for short living tasks.
- Job ensures that a container which executes such a task runs successfully exactly once (or more times).
- Retry on Failure.
- Job Scheduling can be done like
crons .
#11 Daemon Sets
- Daemon Sets run pods on all (or a selected set of) nodes in the cluster.
- Useful for running containers for logging & monitoring.
#12 Autoscaling
- Horizontal Pod Autoscaling
- Scales ReplicaSets based on pod’s CPU usage or app-provided metrics.
- Cluster Autoscaling
- Depends on
cloud provider. - Scales the no. Of nodes in your cluster based on CPU & Memory usage.
- Depends on
#13 API
- Every functionality is provided via a REST API.
- Easy integration
in our existing workflows(CD). - Command line tool “KUBECTL”(uses REST API internally).
#14 Communities
- Constantly growing community.
- Many contributors from many companies.
Request for Proposal
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Ankit Arora
Ankit is a Redhat Certified Engineer and Cloud Engineer.