IuriiO Notebook
  • Broken Code Notebook
  • Architecture and Design
    • Architectural Decision Records
    • Trade-off Analysis
    • Data Decomposition Drivers
    • Selecting a Database Type
    • Service Granularity
    • Consumer-driven Contracts
  • Cloud
    • AWS
      • Resources
      • Compute
        • EC2
        • Batch
        • ECS & ECR
        • Elastic Beanstalk
      • Storage & Data Management
        • S3
        • Storage Gateway
        • RDS
        • DynamoDB
        • ElastiCache
        • Redshift
        • EBS
        • EFS
        • FSx
        • Snowball
        • Athena
        • Encryption and Downtime
        • Untitled
      • Security & Compliance
        • IAM
        • Web Identity Federation
        • Organizations
        • Service Catalog
        • Tags and Resource Groups
        • STS
        • KMS
        • GuardDuty
        • Compliance
        • Marketplace Security Products
        • DDOS
        • Compliance Frameworks
      • High Availability
        • Global Infrastructure
        • Disaster recovery
        • Elastic Load Balancers
        • Untitled
      • Monitoring & Reporting
        • Cost Explorer
        • CloudWatch
        • Systems Manager
        • Config
        • CloudTrail
        • Cost control
        • Untitled
      • Networking
        • Networking 101
        • Route53
        • CloudFront
        • VPC
        • DirectConnect
        • WAF
        • Shield
        • Global Accelerator
      • Deployment & Provisioning
        • Untitled
        • Untitled
      • Automation & Optimization
        • CloudFormation
          • Links
          • Github resources
          • YAML 101
          • Videos
        • OpsWorks
        • Untitled
      • Application Services
        • SQS
        • SWF
        • SNS
        • Untitled
      • Serverless
        • Lambda
        • API Gateway
        • DynamoDB
        • SAM
        • Untitled
      • Well-Architected Framework
    • Azure
      • Tools
      • Organization & Management
      • Authentication & Authorization
      • Compute
      • Networking
      • Storage
      • Databases
      • Security
      • Privacy, Compliance & Trust
      • Cost Management
  • Containers & Services
    • Docker
      • Useful Links
      • Containers
      • Images
      • Dockerfile
      • System
      • Compose
      • Swarm
      • Docker & NodeJS
    • Kubernetes
      • Useful Links
      • Introduction
      • Getting started
      • Exposing containers
      • Kubernetes Management Techniques
        • Declarative YAML
      • Labels and Annotations
      • Storage in Kubernetes
      • Ingress Controller
      • CRD's and The Operator Pattern
      • Kubernetes Dashboard
      • Kubectl Namespaces and Context
  • Frontend
    • Resources
    • Design
      • Search experience
Powered by GitBook
On this page
  • Basic terms: system parts
  • Installing Kubernetes locally
  • Kubernetes Container Abstractions
  • Kubernetes Run, Create and Apply
  • Basic commands
  • Scaling ReplicaSets
  • Inspecting Deployments

Was this helpful?

  1. Containers & Services
  2. Kubernetes

Getting started

PreviousIntroductionNextExposing containers

Last updated 5 years ago

Was this helpful?

Basic terms: system parts

  • Kubernetes: the whole orchestration system (K8s "k-eights" or Kube for short)

  • Kubectl: CLI to configure Kubernetes and manage apps (using "cube control" official pronunciation)

  • Node: single server in the Kubernetes cluster

  • Kubelet: Kubernetes agent running on nodes

  • Control plane: set of containers that manage the cluster

    • Includes API server, scheduler, controller manager, etcd and more

    • Sometimes called the "master"

Installing Kubernetes locally

  • Kubernetes is a series of containers, CLI's and configurations

  • Many ways to install:

    • MacOS: Docker Desktop - Enable in Settings. Sets up everything inside Docker's existing Linux VM

      • Runs, configures Kubernetes Master containers

      • Manages kubectl install and certificates

      • Easily install, disable and remove from Docker GUI

    • Docker Toolbox on Windows - MiniKube. Uses VirtualBox to make Linux VM

      • Doesn't install kubectl, has to be installed separately

    • Your own Linux host or VM - MicroK8s. Installs Kubernetes right on the OS

      • Uses snap (rather apt or yum) for install.

      • Control MicroK8s service via microk8s. commands

      • kubectl accessible via microk8s.kubectl

      • Add an alias to your shell (.bash_profile): alias kubectl=microk8s.kubectl

  • Kuberneters in a Browser

    • katacoda.com

Kubernetes Container Abstractions

  • Pod: one or more containers running together on one node. Basic unit of deployment. Containers are always in pods.

  • Controller: for creating / updating pods and other objects. Controllers manage pods, you almost never manage pods yourself. There are many types of Controllers, including Deployment, ReplicaSet, StatefulSet, DaemonSet, Job, CronJob, etc.

  • Service: network endpoint to connect to a pod.

  • Namespace: Filtered group of objects in cluster.

  • Secrets, ConfigMaps, etc.

Kubernetes Run, Create and Apply

  • Kubernetes is evolving, and so is the CLI

  • We get 3 ways to create pods from the kubectl CLI

  • kubectl run (changing to be only for pod creation)

  • kubectl create (create some resources via CLI or YAML)

  • kubectl apply (create / update anything via YAML)

Basic commands

  • kubectl version - shows a version of Client and Server

  • kubectl cluster-info

  • kubectl run my-nginx --image nginx - this will create a pod, replica set and a deployment

  • kubectl get pods - get current pods

  • kubectl get all - get all components

  • kubectl delete deployment my-nginx - delete named deployment

Scaling ReplicaSets

  • Start new deployment for one replica/pod

    kubectl run my-apache --image httpd

  • Scale deployment

    kubectl scale deploy/my-apache --replicas 2

    kubectl scale deployment my-apache --replicas 2 (these are same commands)

Inspecting Deployments

  • Get logs

    kubectl logs deployment my-apache

  • Get logs from pods with a given label

    kubectl logs -l run=my-apache

  • brew install stern

    stern pod-query

  • Get pod info

    kubectl describe pod/<pod-id> (pod-id can be obtained with kubectl get pods)`

Stern for Kubernetes can be used to tail logs from multiple pods ()

http://play-with-k8s.com
https://github.com/wercker/stern