Class 5 - Expose App, Scale App and Update App Flashcards
What are Kubernetes Nodes?
- A node is main worker machine
- AKA minions
- Could run on physical machine or VM
- Provides all necessary services to run pods
- Are managed by master
Which are key services running on Node?
- Container Engine (docker, rkt)
- Kubelet
- Kube-proxy
What happens when we do kubeadm join command to create a node?
Kubeadm collects metadata about the machine and stores that object in etcd.
What happens when we delete the node?
On deleting the node, the object that is stored in etcd about that machine is removed. Actual VM is not removed.
Categories of Kubernetes node status? (HINT there are 4 categories)
Kubernetes node status shows valuable information for planning and managing operations.
- Address (internal or external IP) - Static
- Condition (current state of node) - Dynamic
- Capacity (current capacity of node) - Dynamic
- Info - Static
Which command can be used to view node status?
kubectl describe node
will show details about all 4 categories of status
What is the condition category of node status?
Kubernetes keeps on getting current health check of node. That includes memory pressure, disk pressure, PID pressure etc.
What is Ready condition of node?
Ready condition is true when all the other conditions are false. If any condition becomes true, the node status changes to either NotReady, MemoryOutOfBounds, etc.
What information does Kubernetes node status - Capacity category provide?
Describes the resources available on the node. Using this information, you can decide on the number of pods that can be scheduled.
CPU, Memory, Storage are some capacity information available.
Capacity vs Allocatable?
Capacity is the actual resources that are available on the node and allocatable shows how many are free for allocation at any point in time, after subtracting resources taken by OS, etc.
What information does Kubernetes node status - System info provide?
It shows Kernel info, OS details, Kubernetes details (version, kubelet version, kube proxy version etc)
In Kubernetes cluster is node created by Kubernetes itself?
No, a node is not created by Kubernetes. They are created outside of it like on a bare-metal, VM or public cloud.
On creating node in Kubernetes
- It creates an object to the present node
- It validates the object to quality it for running a Pod
- If it doesn’t qualify then it will keep the node in Invalid state unless it is deleted or fixed by admin to qualify.
Which are the three ways to interact with the nodes?
- KubeController - kubectl
- Kubelet
- Node Controller
Which command can be used to edit a node?
kubectl edit node
will allow changing node
Who controls IP addresses of pods on a node?
NodeController controls IP addresses of pods running. Each node gets its block of IP address which it uses to allocate IP address.
Which are the responsibility of Node Controller?
It is part of Kubernetes master
- Assign CIDR blocks to nodes
- Maintain list of nodes
- Monitor health of nodes
What is Kubernetes Service?
Kubernetes service acts as a load balancer. A service can cater to one or more pods. Multiple pods point to single service resource.
Services are nothing but another type of resource which allows pods to be exposed to other pods in cluster or expose the pods to the external world.
What are Kubernetes services equivalent to?
They are equivalent to IP Table rules.
How to decide which pod should be assigned to which service? What are the conventions?
Ideally one service per applciation type.
Which IP address is assigned to service resource?
Service resource are assigned a totally different IP than pod CIDR service.
Is service resource static or dynamic resource and can it fail?
Service resource is static resource and it cannot fail. It has fixed IP.
What type of Service resource will you create when you want a application to be available within cluster?
ClusterIP service resource can be used.
Do we care which IP address the service is provided?
Not really, because pod can connect to the service using DNS name which is service name.
Is pod to pod direct communication possible using pod name?
No a pod to pod communication is not possible directly using pod name, only through service can this be done.
Suppose we want expose a pod to the external world, which are the ways to do that?
There are two types of service resource that allow us to do that
1) NodePort - which is same as docker port mapping, where in internal container port will be mapped with host machine port.
2) LoadBalancer - it is same as NodePort with the difference is that it assigns external IP address. This is only available for cloud deployments and not available for on-premise deployments. Only on Managed Kubernetes Services.
Example command to expose a nginx pod using ClusterIP service type?
kubectl expose pod –port= –type=ClusterIP
When we don’t provide external port then Kubernetes itself assigns.
The cluster IP will be static IP and will be different than Pod network CIDR.
Which command can be used to display Kubernetes service?
kubectl get svc
or
kubectl get services