Kubernetes Flashcards

1
Q

What is Kubernetes?

A

an open-source system for automating deployment, scaling, and management of containerized applications.

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

What is container orchestration?

Follow-up: How does Kubernetes help with container orchestration?

A

Container orchestration is the automation of the operational effort to run containerized workloads and services. This includes provisioning, deployment, scaling (up and down), networking, load balancing, etc.

Kubernetes provides a framework to run distributed, containerized systems easily.

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

What is a cluster?

A

A cluster is a Kubernetes deployment. Each cluster consists of a set of worker machines, called nodes, that run containerized applications. Every cluster has a control plane and at least one worker node.

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

What is a Pod?

Follow-up: Write an example of a pod.yml

A

A unit of deployment for Kubernetes. Required for running containers, and provides a shared execution environment of components the app may need to run.

Follow-up: Hello-pod example

apiVersion: v1 # if in the core group, no need to add the group name
kind: Pod # kind of Kubernetes object
metadata: 
  name: hello-pod
  labels:
    app: hello-demo
spec:
  # restartPolicy: Never
  containers:
  - name: hello
    image: kth844/hello-demo 
    # resources:
    #   limits:
    #     memory: "128Mi"
    #     cpu: "500m"
    ports:
      - containerPort: 8080 #has to match ports from the application
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a Service?

Follow-up: Write an example of a service.yml

A

An abstract way to expose an application running on a set of Pods as a network service.
With Kubernetes, you don’t need to modify your application to use an unfamiliar service discovery mechanism.

Follow-up: hello-service example

apiVersion: v1
kind: Service
metadata:
  name: hello-service
spec:
  type: NodePort
  selector:
    app: hello-demo
  ports:
  - port: 80 # what service is listening on, in cluster that is tied to cluster ip, if we're using dns (access via name)
    targetPort: 8080 # match port for application
    nodePort: 31000 # port is usually (30000-32767), accessible from outside of the cluster
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a deployment?

Follow-up: Write a deployment.yml example

A

A Deployment provides declarative updates for Pods and ReplicaSets.

By describing the desired state in a Deployment, the Deployment Controller changes the actual state to the desired state at a controlled rate. They also can create new ReplicaSets, or remove existing Deployments and adopt all their resources with new Deployments.

Follow-up: hello-deployment example
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-deployment
  labels:
    app: hello # NOT RELATED TO THE PODS THEMSELVES, used for grouping and such in other tools
spec: # spec for deployment object
  replicas: 5
  selector:
    matchLabels:
      app: hello-demo # to know which pod to work on, has to match labels in the template
  template: # describes to the pods to be created
    metadata:
      labels:
        app: hello-demo
    spec: # spec for the pod
      containers:
        - name: hello
          image: kth844/hello-demo 
          imagePullPolicy: Always
          ports:
            - containerPort: 8080 #has to match ports from the application
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a replicaSet?

A

ReplicaSets maintain a stable set of replica Pods running at any given time. It is in charge of replicating pods to match the criteria defined. Fields include:

  • selector(specifies how to identify pods to acquire)
  • number of replicas it should be maintaining
  • pod template(info on the data for new pods it creates)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the difference between a pod and a node

A

Pods are the smallest deployable units of computing that you can create and manage in Kubernetes. A pod is is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers.

Nodes are managed by the control plane and contain the services necessary to run Pods.

Nodes contain Pods.

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

True/False: When grouping resources, containers with different resources should be placed in the same pod?

A

False, containers should only be grouped together in a pod if they need to share the same resources.

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

What is the purpose of the Control Plane(Head Node/Master Node) in Kubernetes?
Follow-up: What about the worker nodes?
Bonus: What are the components of the Control Plane?

A

The Control plane is in charge of the cluster and generally has 3 nodes, up to 5.
Usually, only 1 node is actually making changes to a cluster, dubbed the “leader”.

Follow-up:
Handles work, or pods, that is coming from the scheduler.
Composed of kubelet, container runtime, and a kube-proxy.

Bonus:
Kube-API: receiving communication for the control plane, sends .yml manifests to the API server
Kube-Control Manager: Controls the controllers(node controller, deployment controller) and ensures the observed state of the cluster matches the desired one.
Kube-Scheduler: watches the apiserver for new work/applications and assigns work to cluster nodes

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

What is the Kubernetes API Server?

A

The core of Kubernetes’ control plane is the API server. The API exposes an HTTP API that lets end-users, different parts of your cluster, and external components communicate.

Kubernetes API lets you query and manipulate the state of API objects in Kubernetes (i.e. Pods, Namespaces, ConfigMaps, and Events).

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

What are the different components that make up a Control Plane?
Bonus: Define some of their uses/purposes

A

kube-apiserver: exposes the Kubernetes API. The API server is the front end of the Kubernetes control plane.

etcd: store all its data – its configuration data, its state, and its metadata.
scheduler: watches for newly created Pods with no assigned node, and selects a node for them to run on.

controller manager: runs controller processes.

cloud controller manager: cloud-specific control logic. The cloud controller manager lets you link your cluster into your cloud provider’s API.

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

What are the components that make up a worker node?

Bonus: define some of their uses/ purposes

A

Kubelet: An agent that runs on each node in the cluster. It makes sure that containers are running in a Pod.

Kube-proxy: Kube-proxy is a network proxy that runs on each node in your cluster, it maintains network rules on nodes.

container runtime: Software that is responsible for running containers.

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

What are the different types of services?

Bonus Points: Define what a service object is.

A

ClusterIp: creates stable ip address within a cluster and allows a request to reach a set of pods once inside of the cluster.

NodePort: external access via nodes.

LoadBalancer: built on top of clusterip and nodeport, seamlessly integrates with cloud providers and their load balancers.

Service object: An abstract way to expose an application running on a set of Pods as a network service.

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

How would you use K8 to deploy a Spring Boot Application?

A

https://www.section.io/engineering-education/spring-boot-kubernetes/

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

What is the role of Docker in Kubernetes deployment?

A

Docker assists with the containerization of applications so that they can be deployed onto K8 nodes.

17
Q

How would you make a request to a Docker container deployed through Kubernetes?

A
  • Create a service that exposes the deployment of the container.kubectl expose deployment –type=NodePort –name=
  • Make requests to the service and the requests will be forwarded to an instance of the Docker container. For example:curl http://:
18
Q

What is meant by self-healing? How does K8 leverage this feature?

A

Self-healing Kubernetes restarts containers that fail, replaces containers, kills containers that don’t respond to your user-defined health check, and doesn’t advertise them to clients until they are ready to serve.

*Self-healing means that to many degrees, K8 can automate the toil of having to “check-in” on deployed resources.