Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Kubernetes Intro

Kubernetes Intro

Kuberentes 101 from Montreal Kuberentes Meetup. Kubernetes Birthday.

cncf-canada-meetups

July 26, 2016
Tweet

More Decks by cncf-canada-meetups

Other Decks in Technology

Transcript

  1. Page Kubernetes Montréal - Plans for 2016 • Collaborate with

    Docker Montreal & other related meetups • Quarterly meetups • Looking for sponsors, organizers, speakers (reach us via meetup.com) • Create a logo, social media #kubernetes • Planning hands-on workshops and hackathons 5
  2. Page Kubernetes Montréal - Topics • Kubernetes and ecosystem •

    Container ecosystem: Docker and Rkt • Networking, storage and scheduling for K8s • Using Kubernetes with CM, CI/CD • Unique use cases and how Kubernetes helped your team/company • Deploying and using Kubernetes in production in the enterprise • Containerized App Development • PaaS, IaaS integrations • Cool new tech and how it can be used with Kubernetes • Kubernetes + IoT • Day 2 Operations (monitoring, troubleshooting, upgrades) of K8s cluster • Orchestrating multi-host, multi-container, distributed applications • Using Kubernetes to manage and secure your application infrastructure
  3. Page Major Container Events in 2016 7 • ContainerCon 2016:

    August 22-24 (Toronto) • OpenStack Summit 2016: October 25-28 (Barcelona) ◦ Vote for our talk on Container Orchestration ◦ https://lnkd.in/euCHUnT (search for Ayrat) • KubeCon 2016: November 8-9 (Seattle)
  4. 1.2 • Deployments • DaemonSets • New UI • Simplified

    Deployments • Automated Cluster Management • Improved Scale 1.3 • Legacy application support • Cluster Federation • More nodes • In-cluster IAM • Scheduled jobs • Cluster autoscaling • Public cloud dashboard
  5. cloudops.com @cloudops_ Page Who am I? 16 Ayrat Khayretdinov •

    OpenStack Engineer at CloudOps • Part of SIG-Openstack Kubernetes community • Organizing OpenStack and K8s Meetup in Montreal
  6. Page Dependency Matrix Hell 18 Dev 1 Laptop Dev 2

    Laptop QA Stage Production OS OS X Windows Debian Debian Debian Frontend nginx (homebrew) nginx (download) nginx (apt-get) nginx (apt-get) nginx (apt-get) Services php (homebrew) php (download) php (apt-get) php (apt-get) php (apt-get) Database mysql (download) mysql (download) mysql (apt-get) mysql (apt-get) mysql (apt-get) Logs /usr/local/etc/nginx/logs/ C:\nginx-1.9.5\logs /var/log/nginx/ /var/log/nginx/ /var/log/nginx/
  7. Page 22 Dependency Matrix Hell Solved Dev 1 Laptop Dev

    2 Laptop QA Stage Production OS Frontend Services Database Logs
  8. Page A Toolkit for Running Containerized Distributed Systems in Production

    26 Co-locating helper processes Mounting storage systems Distributing secrets Application health checking Replicating application instances horizontal auto-scaling Naming and discovery Load balancing Rolling updates resource Monitoring Log access and ingestion support for debugging
  9. Page Container Runtime 27 Not all containers are Docker containers

    Kubernetes support rkt containers runtime start from v 1.3 In devel: hyper_ (Hyper.sh), LXC AVOID LOCK-IN
  10. Page How to consume Kubernetes ? 32 • From Scratch

    - anywhere • Public Cloud ◦ GCE, Amazon, Azure • Private Cloud ◦ OpenStack (Murano, Magnum) ◦ CloudStack • Hosted • On premises VMs ◦ VMware • Local-machine Solutions ◦ MiniKube
  11. Page Concept: Pods 36 Pod Git Synchronizer Node.js App Container

    Volume Consumers git Repo Logical Application Can be used to group multiple containers & shared volumes Containers within a pod are tightly coupled Shared namespaces • Containers in a pod share IP, port and IPC namespaces • Containers in a pod talk to each other through localhost Ephemeral
  12. Page Pod Networking (across nodes) 37 Pods have IPs which

    are routable Pods can reach each other without NAT Even across nodes No Brokering of Port Numbers Many solutions Flannel, Weave, OpenVSwitch, Cloud Provider, Calico 10.1.2.0/24 10.1.1.2 10.1.2.106 10.1.3.0/24 10.1.3.45 10.1.3.17 10.1.3.0/24
  13. Page Working with configuration files Kubernetes supports two different file

    formats YAML and JSON. Each format can describe the same function of K8s: • YAML The YAML format is very simple with less syntax rules. Refer to http://www.yaml.org/spec/1.2/spec.html The following example uses the YAML format to set up the nginx pod: • JSON The JSON format is also simple and easy to read by humans, but more program-friendly. Because it has data types (number, string, Boolean, and object), it is popular to exchange the data between systems. Refer to http: //json.org/ • SWAGGER There is an alternative way, because Kubernetes is also using swagger (http://swagger.io/) to generate the REST API; therefore, you can access swagger-ui via http://<kubernetes-master>:8080/swagger-ui/. Example of configs: https://github.com/kubernetes/kubernetes/tree/master/examples 39
  14. Page Concept: Labels 40 • Arbitrary metadata • Attached to

    any API object • Generally represent identity • Queryable by selectors – think SQL ‘select ... where ...’ • The only grouping mechanism – pods under a ReplicationController – pods in a Service – capabilities of a node (constraints) Example: “phase: Dev”
  15. Page Concept: Services 44 • A group of pods that

    act as one == Service – group == selector • Defines access policy – load balanced (from CloudProvider) – NodePort (Minikube) – ClusterIP (interal only) - - - -
  16. Page Concept: Deployments 46 ... Deployment drives current state towards

    desired state. E.g: I want 3 replicas of my pod Deployment manages replica changes for you • stable object name • updates are configurable, done server-side • kubectl edit or kubectl apply Aggregates stats Can have multiple updates in flight
  17. Page Replication Controllers 47 Replication Controller - Name = “nifty-rc”

    - Selector = {“App”: “Nifty”, "Phase": "Dev", "Role": "FE"} - PodTemplate = { ... } - NumReplicas = 4
  18. Feature: Rolling Update Node 1 Pod hello Pod hello Node

    Pod hello Node Pod hello Node Pod hello Service
  19. Rolling Update Node 1 Pod hello Pod hello Node Pod

    hello Node Pod hello Node Pod hello Service Pod goodbye
  20. Rolling Update Node 1 Pod hello Pod hello Node Pod

    hello Node Pod hello Node Pod hello Service Pod goodbye
  21. Rolling Update Node 1 Pod hello Pod hello Node Pod

    hello Node Pod hello Node Pod hello Service Pod goodbye
  22. Rolling Update Node 1 Pod hello Pod hello Node Pod

    hello Node Node Pod hello Service Pod goodbye Pod goodbye
  23. Rolling Update Node 1 Pod hello Pod hello Node Pod

    hello Node Node Pod hello Service Pod goodbye Pod goodbye
  24. Rolling Update Node 1 Pod hello Pod hello Node Pod

    hello Node Node Pod hello Service Pod goodbye Pod goodbye
  25. Rollout Node 1 Pod hello Pod hello Node Pod hello

    Node Node Service Pod goodbye Pod goodbye
  26. Rolling Update Node 1 Pod hello Pod hello Node Pod

    hello Node Node Service Pod goodbye Pod goodbye Pod goodbye
  27. Rolling Update Node 1 Pod hello Pod hello Node Pod

    hello Node Node Service Pod goodbye Pod goodbye Pod goodbye
  28. Rolling Update Node 1 Pod hello Pod hello Node Pod

    hello Node Node Service Pod goodbye Pod goodbye Pod goodbye
  29. Rolling Update Node 1 Pod hello Pod hello Node Node

    Node Service Pod goodbye Pod goodbye Pod goodbye