Skip to content

Instantly share code, notes, and snippets.

@arnaldopereira
Created April 4, 2016 10:45
Show Gist options
  • Save arnaldopereira/44e7388d807613fea590788fd97eac20 to your computer and use it in GitHub Desktop.
Save arnaldopereira/44e7388d807613fea590788fd97eac20 to your computer and use it in GitHub Desktop.
pods
Pods are groups of containers that are deployed and scheduled together. Pods form the atomic unit of scheduling in Kubernetes, as opposed to single containers in other systems. A pod will typically include 1 to 5 containers which work together to provide a service. In addition to these user containers, Kubernetes will run other containers to provide logging and monitoring services. Pods are treated as ephemeral in Kubernetes; you should expect them to be created and destoyed continually as the
system evolves.
services
Services are stable endpoints that can be addressed by name. Services can be connected to pods by using label selectors; for example my “cache” service may connect to several “redis” pods identified by the label selector “type”: “redis”. The service will automatically round-robin requests between the pods. In this way, services can be used to connect parts of a system to each other. Using services provides a layer of abstraction that means applications do not need to know internal details of
the service they are calling; for example application code running inside a pod only needs to know the name and port of the database service to call, it does not care how many pods make up the database, or which pod it talked to last time. Kubernetes will set up a DNS server for the cluster that watches for new services and allows them to be addressed by name in application code and configuration files.
It is also possible to set up services which do not point to pods but to other preexisting services such as external APIs or databases.
replication controllers
Replication controllers are a pod factory, they are what build pods.
Replication controllers are the normal way to instantiate pods in Kubernetes (typically, you don’t use the Docker CLI in Kubernetes). They control and monitor the number of running pods (called replicas) for a service. For example, a replication controller may be responsible for keeping 5 Redis pods running. Should one fail, it will immediately launch a new one. If the number of replicas is reduced, it will stop any excess pods. Although using replication controllers to instantiate all pods
adds an extra layer of configuration, it also significantly improves fault tolerance and reliability.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment