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

Kubernetes the Hardware Way

Kubernetes the Hardware Way

Kubernetes is a powerful system for operating application containers across a cluster of machines. In this talk, we'll explore CoreOS cluster provisioning and Kubernetes setup on hardware. To start, we'll cover PXE network setup and Ignition, CoreOS's built-in early-boot provisioning tool. Then we'll discuss matchbox, a service which matches machines to profiles to provision complete clusters. We'll walk through PXE booting machines, installation to disk, and automated provisioning of a multi-node Kubernetes cluster. We’ll show how the approach extends across machines and to provisioning many different kinds of clusters, including "self-hosted" Kubernetes and rktnetes.

Dalton Hubble

January 25, 2017
Tweet

More Decks by Dalton Hubble

Other Decks in Programming

Transcript

  1. Preboot eXecution Environment (PXE) • Clients boot correct image and

    configuration • Discover, download, and run an NBP • Environment must provide: ◦ Initiation mechanism ◦ Network Services for client NICs ◦ Boot firmware APIs for the NBP
  2. Initiation Mechanism • Boot order ◦ Disk first, then network

    ◦ Works well with auto-updates • BMC ◦ IPMI ◦ ipmitool -H <node> chassis bootdev pxe
  3. PXE Client DHCP Server TFTP Server matchbox iPXE Client undionly.kpxe

    boot server, filename PXEClient 67/UDP 69/UDP
  4. NBP • Load kernel & initrd • PXELINUX • iPXE

    (undionly.kpxe) ◦ Flash or Chain ◦ Config script file ◦ Knows HTTP
  5. PXE Client DHCP Server TFTP Server matchbox iPXE Client undionly.kpxe

    boot server, filename boot server, filename PXEClient PXEClient, ipxe 67/UDP 69/UDP
  6. PXE Client DHCP Server TFTP Server matchbox iPXE Client undionly.kpxe

    boot server, filename iPXE Config boot server, filename PXEClient PXEClient, ipxe 67/UDP 69/UDP HTTP
  7. CoreOS Ignition • Early-boot disk provisioning (initramfs) ◦ Partition and

    format disks ◦ Write systemd units, networkd units, files ◦ Create users and groups • Runs once • Atomic
  8. CoreOS matchbox • Matches machines to Profiles • Serves templated

    Ignition configs ◦ iPXE Config ◦ Ignition Config ◦ cloud-config, kickstart, etc. • Read-write gRPC API
  9. Kubernetes (static) k8s-controller.ign etcd flannel kubelet rkt | Docker Kubernetes

    control plane pods k8s-worker.ign etcd (proxy) flannel kubelet rkt | Docker App App
  10. Write a systemd Unit systemd: units: - name: etcd2.service enable:

    true dropins: - name: 40-etcd-cluster.conf contents: | [Service] Environment="ETCD_NAME={{.etcd_name}}" Environment="ETCD_ADVERTISE_CLIENT_URLS=http://{{.domain_name}}:2379" Environment="ETCD_INITIAL_ADVERTISE_PEER_URLS=http://{{.domain_name}}:2380" Environment="ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379" Environment="ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380" Environment="ETCD_INITIAL_CLUSTER={{.etcd_initial_cluster}}"
  11. Kubelet systemd: units: - name: kubelet.service enable: true contents: |

    ... ExecStart=/usr/lib/coreos/kubelet-wrapper \ --api-servers={{.k8s_controller_endpoint}} \ --pod-manifest-path=/etc/kubernetes/manifests \ ...
  12. kube-apiserver.yaml storage: files: - path: /etc/kubernetes/manifests/kube-apiserver.yaml filesystem: root contents: inline:

    | apiVersion: v1 ... - name: kube-apiserver image: quay.io/coreos/hyperkube:v1.5.2_coreos.0
  13. kubelet kube-proxy apiserver controller-manager scheduler kube-dns Rkt | Docker kubelet

    kube-proxy Rkt | Docker Kubernetes (static) Controller Worker
  14. Userspace NBP Early Userspace Network Boot Ignition m ulti-user system

    d netw orkd iPXE coreos-install netw orkd reboot
  15. Userspace NBP Early Userspace Network Boot Ignition m ulti-user system

    d netw orkd iPXE coreos-install netw orkd reboot
  16. Userspace NBP Early Userspace Network Boot Ignition m ulti-user system

    d netw orkd iPXE coreos-install netw orkd reboot
  17. Userspace NBP Early Userspace Network Boot Ignition m ulti-user system

    d netw orkd iPXE coreos-install netw orkd reboot
  18. Themes • Lightweight, auto-upgrading base OS • Leverage DHCP and

    PXE • Simple, powerful provisioning system • Minimize on-host configs • The cluster is your configuration manager
  19. kubelet kube-proxy apiserver controller-manager scheduler kube-dns Rkt | Docker kubelet

    kube-proxy Rkt | Docker Kubernetes (self-hosted) Controller Worker H O S T kubelet kubelet
  20. kubelet kube-proxy apiserver scheduler Rkt | Docker kubelet kube-proxy Rkt

    | Docker Kubernetes (self-hosted) Controller Worker H O S T kubelet kubelet controller-manager kube-dns
  21. rktnetes systemd: units: - name: kubelet.service enable: true contents: |

    ... ExecStart=/usr/lib/coreos/kubelet-wrapper \ --container-runtime=rkt \ ...
  22. CoreOS is Hiring! [email protected] 90+ Projects on GitHub, 1,000+ Contributors

    coreos.com Support plans, training and more OPEN SOURCE ENTERPRISE