Kubernetes A Winning Container War
Posted By : Ankit Arora | 26-Jun-2017
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:-
- Smallest deployable unit
- Group of tightly coupled containers
- Shared network & data volumes.
- Routable IP.
- Run x copies(replica) of a pod.
- Can start or kill pods if necessary.
- Handle pod failures using health checks.
- Contains declarations of our application
- Which container(image/tag).
- Environment variables.
- Data volumes.
- Defines no. of replicas.
- Creates replicaSet which in turn create pods.
- Service provides a permanent virtual IP & DNS to Pods.
- Proxy traffic to selected pods.
- Simple load balancing.
- Combination/Group of K8s resources(pods,
defaulteverything is in “default” namespace.
- Can create namespaces for environments(test,staging,production,etc.)
- Restrict access to specific namespaces for k8s users.
- Namespaces can have
sepearatednetwork(just like VPC in AWS.)
Clusteris 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
youapps 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 sharesthe same volume.
- Many volume types:
- AWS Block Storage.
- Can be preconfigured by cluster admins for easier usage by cluster users.
Petsetis 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.
- 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
#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.
- Horizontal Pod Autoscaling
- Scales ReplicaSets based on pod’s CPU usage or app-provided metrics.
- Cluster Autoscaling
- Depends on
- Scales the no. Of nodes in your cluster based on CPU & Memory usage.
- Depends on
- Every functionality is provided via a REST API.
- Easy integration
inour existing workflows(CD).
- Command line tool “KUBECTL”(uses REST API internally).
- Constantly growing community.
- Many contributors from many companies.