Concepts Flashcards

1
Q

A node

A

A node is a machine – physical or virtual – on which kubernetes is installed. A node is a worker machine and this is were containers will be launched by kubernetes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A minion

A

A node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A cluster

A

A cluster is a set of nodes grouped together. This way even if one node fails you have your application still accessible from the other nodes. Moreover having multiple nodes helps in sharing load as well.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The master

A

The master is another node with Kubernetes installed in it, and is configured as a Master. The master watches over the nodes in the cluster and is responsible for the actual orchestration of containers on the worker nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Kubernetes components

A

An API Server. An ETCD service. A kubelet service. A Container Runtime, Controllers and Schedulers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The API server

A

The API server acts as the front-end for kubernetes. The users, management devices, Command line interfaces all talk to the API server to interact with the kubernetes cluster.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

ETCD

A

ETCD is a distributed reliable key-value store used by kubernetes to store all data used to manage the cluster. Think of it this way, when you have multiple nodes and multiple masters in your cluster, etcd stores all that information on all the nodes in the cluster in a distributed manner. ETCD is responsible for implementing locks within the cluster to ensure there are no conflicts between the Masters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The scheduler

A

The scheduler is responsible for distributing work or containers across multiple nodes. It looks for newly created containers and assigns them to Nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The controllers

A

The controllers are the brain behind orchestration. They are responsible for noticing and responding when nodes, containers or endpoints goes down. The controllers makes decisions to bring up new containers in such cases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The container runtime

A

The container runtime is the underlying software that is used to run containers. In our case it happens to be Docker.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The kublet

A

And finally kubelet is the agent that runs on each node in the cluster. The agent is responsible for making sure that the containers are running on the nodes as expected. Kubelet is responsible for interacting with the master to provide health information of the worker node and carry out actions requested by the master on the worker nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The kube command line tool

A

ONE of the command line utilities used to deploy and manage applications on a kubernetes cluster, to get cluster information, get the status of nodes in the cluster and many other things.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

kubectl

A

ONE of the command line utilities used to deploy and manage applications on a kubernetes cluster, to get cluster information, get the status of nodes in the cluster and many other things.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

kubectl run

A

Deploy an application on the cluster.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

kubectl cluster-info

A

View information about the cluster.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

kubectl get pod

A

List all the nodes part of the cluster.

17
Q

Master vs worker nodes - worker.

A

Worker is were the containers are hosted.

A container runtime (Docker, Rocket, CRIO etc.)

Kubelet agent.

18
Q

Minikube vs Kubeadmin vs play-with-k8s.com

A

A single instance of Kubernetes in an All-in-one setup vs tool used to configure kubernetes in a multi-node setup. Online.

19
Q

Minikube

A

Minikube bundles all components into a single image providing us a pre-configured single node kubernetes cluster so we can get started in a matter of minutes.

The whole bundle is packaged into an ISO image and is available online for download. Minikube provides an executable command line utility that will AUTOMATICALLY download the ISO.

You must have a hypervisor installed, kubectl installed and minikube executable installed on your system.

20
Q

Kubeadmin

A

The tool helps us setup a multi node cluster with master and workers on separate machines.

21
Q

Kubeadmin 6 steps

A
  1. You must have multiple systems or virtual machines created for configuring a cluster.
  2. Install a container runtime on the hosts.
  3. Install kubeadmin tool on all the nodes.
  4. Initialize the Master server.
  5. POD network
  6. Join the worker nodes to the master node
22
Q

A pod

A

The containers are encapsulated into a Kubernetes object known as PODs. A POD is a single instance of an application. A POD is the smallest object, that you can create in kubernetes. oneToOne or oneToMany

23
Q

kubectl run nginx –image nginx

Dostęp do nginx z node / z poza

A

Tak / Nie

24
Q

2 deployment strategies

A

RECREATE UPDATE First destroy all old instances and deploy newer versions - the app is down an inaccessible to users.

ROLLING UPDATE (default) destroy old and deploy new one by one - the app never goes down.

25
Q

How can you update your deployment?

A

1. Update a definition file and run

kubectl apply -f my-updated-file.yml

A new rollout is triggered and a new version of deployment is created.

  1. kubectl set image deployment/my-app-deployment nginx=nginx:new-version (does not update yml)
26
Q

Upgrades / rollbacks under the hood

A
  1. First deployment - a replica set with replicas( pods) created.
  2. Upgrade - new replica set created and deployment of the new replica set and at the same time taking down the old pods (based on the strategy).
  3. in case of rollback - You will have 2 replica sets - old and new. You can rollback

kubectl rollout undo deployment/myapp-deployment

27
Q

Deployment:

create

get

update

status

rollback

A

kubectl

create -f my-deployment.yml / run my-pod –image=x

get deployments

apply -f my-deployment.yml

set image deployment/my-deployment –image=x:1

rollout status / history / undo deployment/my-deployment

28
Q

NEtworking

A

In docker world addres assigned to a container, in Kubernetes to a POD. Each pod in a node get internal IP address. Kube creates internal network for a node e.g. 10.244.0.0 and all pods inthe node are attached to this. eg 10.244.0.2 , 3, 4. The internal IP can change?.

For a cluster you need a 3rp party sollution, so that each pods can communicate with each other without IP conflicts. e.g. Calico Kubernetes expects us to configuret the network in a cluster so that all nodes /pods/ container can communicate with each other without NAT

29
Q

Services

A

They enable loose coupling betwen microservices in our application.

e.g. we have a web app in a pod. From inside the node we can curl the pod. From outside:

NodePort service. Service listeins on node’s port and forwards to pod

http://<node-ip>:<service-port-that-redirects-to-pod></service-port-that-redirects-to-pod></node-ip>

30
Q

Service’s types

A

NodePort : world to pod

ClusterIP: virtual IP inside the cluster to enable communication between different services such as set of frontend servers and a set of backend servers.

LoadBalacer: for use with cloud provider - e.g. to distribute the load between servers in the frontend tier.

31
Q

NodePort Service

A

The service is like a virtual addres inside the node.

Inside the cluster it has it’s onw IP address, called the cluster IP of the service

NODE PORT<->cIOTS:PORT<->TARGET PORT

3200-32767

32
Q

my-service.yaml - root

A

apiVersion: v1

kind: Service

metadata:

name: my–service

spec:

33
Q

my-service.yaml spec

A

spec:

type: NodePort

ports:

  • targetPort: 80
    port: 80

nodePort: 3000

selctor:

app: my-pod
type: web-tier

34
Q

targetPort, port, nodePort - which are mandatory?

A

port, targetPort will be the same, nodePort will be random 30000 - 32767

35
Q

A service uses selector to know the pod:

  1. what’s with multiple pods in a node?
  2. what’s with multiple pods accross nodes?
A
  1. acts as a load balacer - random
  2. Kubernetes creates a service that spans all nodes:

From outside you use <node-ip>:<the-same-port-as-defined-in-the-yaml></the-same-port-as-defined-in-the-yaml></node-ip>

To sume up - no matter if a single /multiple pods / multiple nodes, you create the service exactly the same way.

36
Q

What’s the use of a cluster IP

A

Kube provides us with an interface to access a group of pods. Layers can scale without impacting other layers. Plus - pods’ ip’s change so we should not rely on that communication. And we don’t need to make a desision which pod shoud communicate whit which, between layers (random algorithm).

37
Q

clusterIP.yaml (all)

A

apiVerison: v1

kind: Service

metadata:

name: back-tier

spec:

type: ClusterIP <default></default>

ports:

  • targetPort: <where-the-backend-is-exposed></where-the-backend-is-exposed>
    port: <where-the-service-is-exposed></where-the-service-is-exposed>

selector:

app: my-app
type: backedn-tier

38
Q

LoadBalancer

A

Without native cloud support acts as a node port.

To load balance you may use either native or vm with eg,. nginx