This document provides an overview of Kubernetes, an open-source system for automating deployment, scaling, and management of containerized applications. It describes Kubernetes' architecture including nodes, pods, replication controllers, services, and networking. It also discusses how to set up Kubernetes environments using Minikube or kubeadm and get started deploying pods and services.
Container Orchestration
• Schedule containersto physical/virtual machines
• Restart containers if they stop
• Provide private container network
• Scale up and down
• Service discovery
Kubernetes
• Greek for“Helmsman”; also the root of
the word “governor” and “cybernetic”
• Orchestrator for containers
• Builds on Docker containers
• Also supporting other container technologies
• Multi-cloud and bare-metal environments
• Inspired and informed by Google’s
experiences and internal systems
• 100% Open Source, written in Go.
• Release 1.0 21th July 2015
Large-scale cluster management at Google with Borg https://research.google.com/pubs/pub43438.html
Setup Kubernetes Environment
•Minikube
• Simplest way to get Kubernetes cluster up and running
• Support Microsoft Windows and Mac OSX
• Kubernetes Multi-Node Cluster
• Emulates production environment
• Good for testing advanced scenarios
• Google Container Engine
• Hosted and managed by Google
• Powered by Google Compute Engine
17.
Getting Started withMinikube
• Install Oracle VirtualBox for Mac
• Install Docker Toolbox for Mac
• Install Docker Version Manager
• Install the latest version of Minikube for Mac OSX
• Download the latest version of kubectl from this link
• Run the following commands from the directory where kubectl is downloaded
• chmod +x ./kubectl
• sudo mv kubectl /usr/local/bin
• Launch minikube with the following command:
• minikube start –wm-driver=virtualbox
• Test minikube installation with the following commands
• minikube status
• kubectl get cs
18.
kubeadm
master.myco.com# apt-get install-y kubelet kubeadm kubectl kubernetes-cni
master.myco.com# kubeadm init
Kubernetes master initialized successfully!
You can now join any number of nodes by running the following command:
kubeadm join --token 48b69e.b61e2d0dd5c 10.140.0.3
node-01.myco.com# apt-get install -y kubelet kubeadm kubectl kubernetes-cni
node-01.myco.com# kubeadm join --token 48b69e.b61e2d0dd5c 10.140.0.3
Node join complete.
master.myco.com# kubectl apply -f https://git.io/weave-kube
Network setup complete.
Service Types
• ClusterIP
•Service is reachable only from inside of the cluster
• NodePort
• Service is reachable through <NodeIP>:NodePort address.
• LoadBalancer
• Service is reachable through an external load balancer mapped to
<NodeIP>:NodePort address
26.
Service Discovery -Environment variables
•Kubernetes creates Docker Link compatible environment variables in
all Pods
• Containers can use the environment variable to talk to the service
endpoint
27.
Service Discovery -DNS
• The DNS server watches Kubernetes API for new Services
• The DNS server creates a set of DNS records for each Service
• Services can be resolved by the name within the same namespace
• Pods in other namespaces can access the Service by adding the
namespace to the DNS path
• my-service.my-namespace
28.
Replication Controller
• Ensures that a Pod or homogeneous set of Pods are always up and
available
•Always maintains desired number of Pods
• If there are excess Pods, they get killed
• New pods are launched when they fail, get deleted, or terminated
• Creating a replication controller with a count of 1 ensures that a Pod
is always available
• Replication Controller and Pods are associated through Labels
Replica Set
• Replica Sets are the next generation Replication Controllers
•Ensures specified number of pods are always running
• Pods are replaced by Replica Sets when a failure occurs
• New pods are automatically scheduled
• Labels and Selectors are used for associating Pods with Replica Sets
• Usually combined with Pods when defining the deployment
Pod to Pod
•Kubernetes imposes the following fundamental
requirements on any networking implementation
• all pods (containers) can communicate with all other
containers without NAT
• all nodes can communicate with all containers (and vice-
versa) without NAT
• the IP that a container sees itself as is the same IP that
others see it as
• Network model
• Can be L3 routed
• Can be underlayed (cloud)
• Can be overlayed (SDN)
36.
Pod to Pod:How?
• On GCE/GKE
• GCE Advanced Routes (program the fabric)
• “Everything to 10.1.1.0/24, send to this VM”
• Plenty of other ways
• AWS: Route Tables
• Weave
• Calico
• Flannel
• OVS
• OpenContrail
• Cisco Contiv
• Others...
Adoption
~4k Commits
in 1.5
+25%Unique
Contributors
Top 0.01% of all
Github Projects
3500+ External
Projects Based
on K8s
Companies
Contributing
Companies
Using