Kubernetes intro
- 摘要
- Kubernetes = popular container orchestrator
- Container Orchestration = Make many servers act like one
- Released by Google in 2015, maintained by large community
- Runs on top of Docker (usually) as a set of APIs in containers
- Provides API/CLI to manage containers across servers
- Many clouds provide it for you
- Many vendors make a "distribution" of it
- Why Kubernetes?
- Orchestration: Next logical step in journey to faster DevOps
- First, understand why you *may* need orchestration
- Not every solution needs orchestration
- Servers + Change Rate = Benefit of orchestration
- Then, decide which orchestrator
- If Kubernetes, decide which distribution
- cloud of self-managed (Docker Enterprise, Rancher, OpenShift, Canonical, VMWare PKS)
- Don't usually need pure upstream
- Kubernetes or Swarm
- Kubernetes and Swarm are both container orchestrators
- Both are solid platforms with vendor backing
- Swarm: Easier to deploy/manage
- Kuberbetes: More features and flexibility
- What's right for you? Understand both and know your requirements
- Advantages of Swarm
- Comes with Docker, single vendor container platform
- Easiest orchestrator to deploy/manage yourself
- Follows 80/20 rule, 20% of features for 80% of use cases
- Runs anywhere Docker does:
- local, cloud, datacenter
- ARM, Windows, 32-bit
- Secure by default
- Easier to trubleshoot
- Advantages of Kubernetes
- Clouds will deploy/manage Kubernetes for you
- Infrastrcture vendors are making their own distributions
- Widest adoption and community
- Fiexible: Covers widest set of use cases
- "Kubernetes first" vendor support
- "No one ever got fired for buying IBM"
- Picking solutions isn't 100% rational
- Trendy, will benefit your career
- CIO/CTO Checkbox
- Kubernetes
- Basic Terms: System Parts
- Kubernetes: The Whole orchestration system
- K8s "k-eights" or Kube for short
- Kubectl: CLI to configure Kubernetes and manage apps
- Using "cube control" official pronumciation
- Node: Single server in the Kubernetes cluster
- Kubelet: Kubernetes agent running on nodes
- Control Plane: Set of containers that manage the cluster
- Includes API server, scheduler, controller manager, etcd, and more
- Sometimes called the "master"
- 介紹:
- Master 1
- Shceduler: 決定where和how 你的container place one the node
- etcd: 儲存 key/value 的地方
- Controller Manager: 決定怎麼執行
- Core DNS:
- Node 1
- kubelet
- kube-proxy
- Master 1
- Kubernetes: The Whole orchestration system
- Install Kubernetes Locally
- Kubernetes is a series of containers, CLI's, and configurations
- Many ways to install, lets focus on easiest for learning
- Docker Desktop: Enable in settings
- Setsup everything inside Docker's existing Linux VM
- Docker Toolbox on Windows: MiniKube
- Uses VirtualBox to make LInux VM
- Your Own Linux Host or VM: MicroK8s
- Installs Kubernetes right on the OS
- Kubernetes In A Browser
- Try http://play-with-k8s.com or katacoda.com in browser
- Docker Desktop
- Runs/configures Kubernetes Master containers
- Manages kubectl install and certs
- Easily install
- Kubernetes Container Abstractions
- Pod: one or more containers running together on the Node
- Basic unit of deployment. Containers are always in pods
- Controller: For createing/updateing pods and other objects
- Many types of Controllers inc. Deployment, ReplicaSet, StatefulSet, DaemonSet, Job, CronJob, etc.
- Service: network endpoint to connect to a pod
- Namespace: Filtered group of objects in cluster
- Secrets, ConfigMaps, and more
- Pod: one or more containers running together on the Node
- Kubernetes Run, Create, and Apply
- Kubernetes is evolving, and so is the CLI
- We get three ways to create pods from the kubectl CLI
- kubectl run (changing to be only for pod creation)
- kubectl create (creaet some resources via CLI or YAML)
- kubectl apply (create/update anything via YAML)
- For now we'll just use run or create CLI
- Later we'll learn YAML and pros/cons of each
- Creating Pods with kubectl
- Are we working?
- kubectl version
- Two ways to deploy pods (containers): Via commands, or via YAML
- Let's run a pod of the nginx web server!
- kubectl run my-nginx --image nginx
- Ignore the warning for now
- Let's list the pod
- kubectl get pods
- Are we working?
- Basic Terms: System Parts