Kubernetes - kimschles/schlesinger-knowledge GitHub Wiki
https://www.youtube.com/watch?v=H-FKBoWTVws https://github.com/reactiveops/k8s-workshop/tree/master/complete https://console.cloud.google.com/getting-started?_ga=2.201732755.-327865664.1531857474&pli=1&tutorial=gke_quickstart Pluarlsight: Getting Started with Kubernetes
Kubernetes is a tool that orchestrates microservices that are build into containers
Kubernetes is a tool that helps:
- Ensure your apps are up 24/7 (as close as possible)
- Devs can deploy code multiple times per day
- Use cloud resources effeciently
- Fault-tolerant, self-healing
- Scalability
K8s Building Blocks
Cluster
* made of of masters and nodes
Masters
parts of the master:
* kube-apiserver
* exposes the REST API
* consumes JSON through mainfest files
* cluster store
* uses etcd
(a key value store)
* stores state and config
* ensures the data is distributed, observable and consistent
* kube-controller-manager
* controles nodes, enpoints and namespace controllers
* watches for changes
* maintains desired state
* kube-scheduler
* watches the apiserver for changes
Nodes
parts of the node:
* kubelet
* main k8s agent
* register node with cluster
* watches apiserver
* creates pods
* reports to master
* endpoint is exposed on :10255
* controller
* pulls images
* starts and stops containers
* usually docker
* kube-proxy
* handles networking
* pod IP addresses
* all containers in a pod have the same IP
* load balances across a service
Pods
* The 'atom' of K8s
* Deploying a pod is all or nothing: either it works or it doesn't
* Made up of one or more containers
* Defined in a manifest file
* The manifest file is sent to the apiserver
* The scheduler deploys it to a node
* No matter how many containers are in your pod, they share an IP
Services
* Pods (and their IPs) are frequently killed; there is a lot of IP churn
* A reliable network endpoint
* Sits in front of a set of pods
* Has a stable IP, DNS and Port so that if a pod is killed and new one if spun up, the contents are always available
* A service load balances and decides which pods recieve requests
* Labels allow you to connect pods to services
* You can configure a service to point to things outside of a cluster
* You can find services in 2 ways:
1. environment variables
2. DNS
There are 3 types of Services in Kubernetes
1. NodePort
* exposes the cluster to the 'outside' through a TCP or UDP port
2. LoadBalancer
* Only sends traffice to healthy pods
3. ClusterIP (default)
* creates a stable, internal IP
Deployments
* Deployments and rollbacks!
* Provides declarative updates for pods and replicasets
Labels
Replica Set vs. Replica Controller
Question: How are databases run in K8s?