KCNA Flashcards
(38 cards)
Idea of Cloud Native Architecture
Optimize software for cost efficiency and reliability
Definition of Cloud Native
Build and run scalable applications in modern and dynamic environments
Reason for Cloud Native
Come away from the monolithic approach
Characteristics of Cloud Native Applications
- High level of automation
- Self healing
- Scalable
- (Cost-) Efficient
- Easy to maintain
- Secure by default
Autoscaling
- vertical scaling
- add more CPU & RAM to the VM so it can handle more
- horizontal scaling
- add more servers / racks to the underlying infrastructure so loadbalancing can kick in
Serverless
- servers are still ofc required
- developers don’t have to deal with things like network, Vms, operating systems etc..
- Function as a Service (FaaS) by cloud vendors
Open Standards
- OCI Spec: image, runtime and distribution specification on how to run, build and distribute containers
- Container Network Interface (CNI): Networking for Containers
- Container Runtime Interface (CRI): Runtimes in Container Orchestration Systems
- Container Storage Interface (CSI): Storage in Container Orchestration Systems
- Service Mesh Interface (SMI)
Use of Containers
- running applications more efficiently
- manage dependencies the application needs easily
Container basics
- originates from the “chroot” command
- nowadays, namespaces and cgroups are used
- share kernel of host machine
- are only isolated processes
4 Cs (outter to inner)
- Cloud
- Cluster
- Container
- Code
Security with Containers
- don’t rely on the isolation properties for security
- containers share kernel with host → risk
- containers can have kernel capabilities which increase the risk
- execution of processes with too many privileges such as root or admin
- use of public images is also a risk
Container Orchestration Fundamentals
- schedule multiple containers to servers in an efficient way
- allocate resources to containers
- Manage availability of containers
- Scale containers if load increases
- provide networking to connect containers
- provision storage for persistent container data
Networking within Containers
- Microservice has interface implemented that can be called for a request
- Network namespaces allow own unique IP adresses and (same) port allocations
- container ports can be mapped to a host ports for accessability
Service Discovery
DNS:
- modern DNS servers with API to register new services
Key-Value-Store:
- database to store information about services, f.e. etcd, Consul or Apache Zookeeper
Service Mesh
- adds a proxy server to every container in your architecture
- this can modify and/or filter network traffic between server and client
- nginx, haproxy and envoy are techs for this
Storage
- containers are ephemeral, read-only, consist of layers
- since a lot of applications need to write files, a read-write layer is put on top of the container image
- to persist data, you need to write it to a disk
- volumes can be used for this
Kubernetes Architecture
- used as a cluster, spanned across multiple servers, works ondifferent tasks and distributes load
- high horizontal scalability
- consists of Control plane and Worker nodes
K8s Control plane
kube-apiserver:
- centerpiece of k8s. All the other components interact with it
etcd:
- the database which holds the state of the cluster
kube-scheduler:
- chooses the worker node that could fit a workload that should be scheduled based on properties like CPU and RAM
kube-controller-manager:
- contains non-terminating control loops that manage the state of the cluster. F.e. this checks if a desired number of your application is available at all times
cloud-controller-manager (optional):
- can be used to interact with the API of cloud providers, to create external resources like load balancers, storage or security groups
K8s Worker node
container runtime:
- responsible for running containers on the worker node, f.e. docker or containerd
kubelet:
- small agent that runs on every worker node. Talks to the api-server and container runtime to handle the starting of containers
kube-proxy:
- a network proxy that handles inside and outside communication of the cluster. Tries to rely on the networking capabilitiesof the underlying operating system
K8s API
- responsible for communication with the cluster
- Authentication
- Authorization
- Admission Control
Containers in K8s
- pods are the smallest compute unit
containerd:
- lightweight and performant implementation to run containers
- most popular container runtime atm
- used by all major cloud providers for Kubernetes As A Service producs
CRI-O
- created by Red Hat, similar to podman and buildah
Docker
- long time standard, but never really made for container orchestration
- usage of docker will be deprecated in Kubernetes 1.23
Networking in K8s
- Container-to-Container communications
- This can be solved by the Pod concept
- Pod-to-Pod communications
- This can be solved with an overlay network
- Pod-to-Service communications
- Implemented by the kube-proxy and the packet filter on the node
- External-to-Service communications
- Implemented by the kube-proxy and the packet filter on the node
- Every Pod gets own IP
- core-dns for name resolution and service discovery
K8s scheduling
- process of choosing the right worker node to run a containerized workload on
- kube-scheduler make the scheduling decisions, but is not responsible for starting it
- scheduling starts when a new Pod is created
- users have to give information about application requirements
- if multiple nodes fit equally, K8s will schedule on the node with the least amount of pods
K8s objects
- apiVersion: Each object can be versioned, so the data structure of the object can change between versions
- kind: the kind of object that should be created
- metadata: used to identify the object like name
- spec: the specification of the object