Microservices deployment
History of deployment options:
- Physical machines: 1990s. Fast deployment, best performance. Configuring/reconfiguring cumbersome.
- Virtual machines (VMs): 2000s. AWS EC2 released in 2006. AWS Elastic Beanstalk is an easy way to deploy. Can create a base image & add new instances. But virtualizing entire VM adds overhead.
- Containers: 2013-initial Docker release (competitor: Solaris Zones). Containers virtualize only OS. Quicker. Need to administer container orchestration solution (eg: Kubernetes or Docker Swarm) or go with hosted solution like Google Container Engine or AWS ECS. Sample load balancer: AWS Elastic Load Balancer (ELB).
- 'Serverless': 2014-AWS Lambda. Managing OS security patches also abstracted out. Competitors: Google Cloud with functions, Microsoft Azure with functions. Open source: Apache Openwhisk & Fission for Kubernetes. Underlying server infrastructure is hidden & abstracted away from specific programming languages. Usage based pricing. But can take time to start up & service the 1st request (long-tail latency) & not designed for long-running services.
Docker:
- Dockerfile
- Push to registry
Kubernetes:
- Cluster resource management: Cluster of machines as pool of CPU, memory, storage.
- Scheduling & service management
Kubernetes Architecture:
- API server: REST API
- Etcd: NoSQL db
- Scheduler
- Controller manager
Kubernetes Node:
- Kubelet: creates/manages pods on node
- Kube-proxy: networking, load balancing
- Pods: App services
Kubernetes Concepts:
- Pod: Single container or sidecar containers that implement supporting functions.
- Deployment: # of instances, versioning with rolling upgrades & rollbacks called 'zero-runtime'.
- Service: IP, DNS, load balancing
- ConfigMap: External config, allows storing passwords as a 'Secret'.
Source: Microservices Patterns by Chris Richardson