From
Building Microservice Systems with Docker and Kubernetes by Ben Straub
- Kubernetes
- Runs docker containers
- Powerful Label matching system for control/grouping/routing traffic
- Spans across hosts - converts a set of computers into one big one
- One master (that sends control commands to minions to execute) - multiple minions (that run docker containers)
- POD - set of docker containers (often just one) always on the same host. For each POD there is one IP address.
- Replication controller - manages lifecycle of PODs which match the labels associated with the RC.
- Services - load balance traffic to PODs based on matching label. For eg. Service (name = frontend) will route traffic to PODs with name = frontend. The PODs may be managed by different RCs.
- Traffic routed by Service named frontend to both old and new version PODs. Once the rollover to new version is completed the traffic continues to get routed to the frontend named PODs which are version 124 and old version PODs and RC are deleted eventually without any downtime.
- Every service gets a DNS entry same as its name. For example, ServiceA, ServiceB etc. POD looks up a service by its name and communicates with minions under that service via the service.
- Service can have ingress port configured to receive inbound traffic. Say port 8000 on ServiceA is opened which will map to a port (say 37654) on every minion.
- Setting up Kubernetes Cluster in AWS:
- Identity and Access Management (IAM) -
- Create user and generate creds/download
- Attach policy
- Get awscli and install it
- Download kubernetes - https://github.com/kubernetes/kubernetes/releases/ and unpack it.
- Open cluster/aws/config-default.sh, edit as needed to change the size of the kubernetes cluster
- Run: KUBERNETES_PROVIDER=aws cluster/kube-up.sh
- Created new VPC 172.20.0.*
- 5 EC2 instances (t2.micro) = 1 master + 4 minions with public Ips
- ASG for minions
- SSH Keys for direct access
- ~/.ssh/kube_aws_rsa
- Kubectl is configured
- ~/.kube/config
- KUBERNETES_PROVIDER=aws cluster/kube-down.sh - to delete all aws resources
No comments:
Post a Comment