mooc-notes

Notes from online courses

View on GitHub

Introduction to Kubernetes - Cloud Academy course by Logan Rakai

Course Introduction

Part 1 - Introduction

Course Overview
Learning Objectives
Prerequisites

Recommendation: Do the Intro to K8s Playground lab after this lesson


Overview of Kubernetes

Part 2 - Kubernetes Overview


Part 3 - Deploying Kubernetes

skipped taking notes


Part 4 - Kubernetes Architecture

Scheduling
K8s Pods
K8s Services
K8s Deployments
Summary

Part 5 - Interacting with Kubernetes

Kubernetes API Server
Interacting with K8s

The different methods are as follows

  1. REST API
    • It is possible but not common to work directly with the API server
    • You might need to if there is K8s client library for your programming language
  2. Client Libraries
    • Handles authenticating and managing individual REST API requests and responses
    • K8s maintains official client libraries for Go, Python, Java, .NET and JS.
    • There are also many community-maintained libraries when no official lib exists.
  3. Command-line tool kubectl - most commonly used
    • Issue high-level commands that are translated into REST API calls
    • Works with local and remote clusters
    • Your k8s success correlates with kubectl skill. You can accomplish all your day-to-day skills with this command
    • Manages all different types of k8s resources, and providers debugging and introspection features
    • Luckily, kubectl follows easy-to-understand design patterns: when you learn to manage one resource, you learn to manage them all
Basic kubectl commands
Web dashboard

Deploying Containerised Applications to Kubernetes

Part 6 - Pods

What’s in a Pod Declaration

Because Pods include containers, the declaration of a pod includes all of the properties that you would expect for running containers, for example with docker run. These include the

Manifest files
Manifests in Action
Why Use Manifests?
Demo
Summary

Part 7 - Services

Manifest
Demo
Summary

Part 8 - Multi-Container Pods

Agenda
Kubernetes Namespaces
Namespace Manifest
Multi-Container Manifest
Logs

There is an issue with the current design for the example. Since k8s can only scale at a Pod level and not at a container level, if you want to scale up one of the containers you will end up scaling up the containers like the Redis container which means each Redis container will maintain its own counter value which is not desirable. So a better design would be to break apart the application into multiple Pods and connecting them to each other using Services. Having said that, it does make sense to sometimes include multiple containers in a Pod - it comes down to how tightly coupled the containers are and if it makes sense to think of them as a single unit.

Summary

Part 9 - Service Discovery

Why Services?
Service Discovery Mechanisms
  1. Environment variables
    • Service addresses automatically injected in containers
    • Env vars follow naming conventions based on service name
  2. DNS
    • DNS records automatically created in cluster’s DNS
    • Containers automatically configured to query cluster DNS
Demo
Environment Variables for Service Discovery
DNS for Service Discovery
Summary

Part 10 - Deployments

Differences between Pod and Deployment manifests
Demo
Summary

Instead of scaling arbitrarily we may want to automatically scale up our resources based on some metrics


Part 11 - Autoscaling

Metrics and CPU requests
Autoscaler Manifest
Summary

Part 12 - Rolling Updates and Rollbacks

Rollouts
Rolling Updates
Demo
Summary

Rollouts depend on container status. K8s assumes that created containers are immediately ready and the rollout should continue. This does not work in all cases. We may need to wait for the web server to accept connections. This is where probes and init containers come into the picture.


Part 13 - Probes

Readiness Probes
Liveness Probes
Declaring Probes
Demo
Summary

Probes kick in after containers are started. If you need to start or prepare things before the container starts there is a way to do that as well - init containers.


Part 14 - Init Containers

Motivation for Init Containers
Init containers
Demo
Summary

Part 15 - Volumes

Agenda
Options available for storing data
Volumes
Persistent Volumes
Persistent Volume Claims
Storage Volume Types
Demo
Summary

Part 16 - ConfigMaps and Secrets

Motivation for ConfigMaps and Secrets
ConfigMaps and Secrets
Using ConfigMaps and Secrets
Demo
Summary

The Kubernetes Ecosystem

Part 17 - Kubernetes Ecosystem


Course Conclusion

Part 18 - Conclusion