Kubernetes

Concepts

  • kube-apiserver is the http api service
  • kube-controller-manager management of resources like services and storage
  • kube-scheduler schedules resources like services and storage
  • kube-proxy load balancing proxy
  • kublet container management and reporting on minions

Terminology

  • namespace a seperate group of pods, replication fcontrollers and services
  • minon a worker node
  • pod a group of containers running on the same node
  • replication controller a controller for a group of pods
  • service internal load balancer for a group of pods

Reference Implementations

  • https://developer.atlassian.com/blog/2017/07/kubernetes-infra-on-aws/

DNS

Applications (pods) are deployed into a namespace. These pods (docker images) are automatically provided with an private ip address via an internal DHCP server that uses the kube-dns resolver. The DNS server is configured to append the namespace to the search domain.

If an application was deployed into the staging namespace and needed to talk to the rabbitmq service in the staging namespace then configure the application to use the unqualified name as it will automatically expand.

nslookup rabbitmq
Server:     192.168.1.11
Address:    192.168.1.11#53

Name:   rabbitmq.staging.svc.cluster.local
Address: 192.168.1.5

If the application needs to talk to the rabbitmq service in the production namespace then use the fully qualified hostname ie. rabbitmq.production.svc.cluster.local

See https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/ for more information.

External DNS

There’s an addon called ExternalDNS that makes Kubernetes resources discoverable via public DNS servers and allows you to control DNS records dynamically via Kubernetes resources in a DNS provider-agnostic way.

Event Log

The event log for pods/containers can be accessed via

$ kutectl get events --watch

An interactive session can be launched to watch/follow the state of pods in the cluster via

$ kubectl get pods --watch

Troubleshooting Guides

The rule of thumb is when you do kubectl logs or kubectl exec the API server makes a request to the kubelet. If you experience problems then refer to this cheat cheat.

Prefabricated Applications

The equivilant of BitNami in the Kubernetes world is https://github.com/kubernetes/charts which are deployed using https://helm.sh/

Recommended Reading

  • https://youtu.be/PH-2FfFD2PU
  • https://github.com/kelseyhightower/kubernetes-the-hard-way
  • https://github.com/hobby-kube/guide