TIL: The path to CKA Week 1.
Tags: cka, kubernetes, preparecka
Published: 2019-12-09 13:33:42

This week, I started the course of k8s Fundamentals that I bought with CKA bundle.
  
The course starts from the history and the basic of container orchestrator, which I'm quite familiar with. So I didn't spend too much time on it.

And follows by the Kubernetes Architecture section. Telling what components that run on k8s cluster and how they work.
For me, this is just a quick review, nothing new.
So I just went through this section and took 100% on knowledge check of this section. 

To do the lab in the course I have to prepare a k8s environment, so I started 2 VMs by VirtualBox on my PC.
There is a Lab during the course that teach you how to install a k8s by kubeadm.
**If you plan to setup a experience environment by VirtualBox, remember to turn off the swap.**
Just a little complain, the document of this CNCF still have room for improvement. Noting bash and YAML codes by pdf format is not a decent way.

After I finished k8s installation, I moved on to the **API and Access** section.
And there is a TIL here 😀.
You can use --v to set the verbose level for kubectl

```
kubectl --v=6 get nodes
``` 
You can even see how kubectl send the curl to the api-server.

Also, I notice that there is a namespace called `kube-node-lease` created by default.
And `kube-node-lease` is to keep the worker node's lease information.
Here's the introduction of lease from official document
>
In versions of Kubernetes prior to 1.13, NodeStatus is the heartbeat from the node. Node lease feature is enabled by default since 1.14 as a beta feature (feature gate NodeLease, KEP-0009). When node lease feature is enabled, each node has an associated Lease object in kube-node-lease namespace that is renewed by the node periodically, and both NodeStatus and node lease are treated as heartbeats from the node. Node leases are renewed frequently while NodeStatus is reported from node to master only when there is some change or enough time has passed (default is 1 minute, which is longer than the default timeout of 40 seconds for unreachable nodes). Since node lease is much more lightweight than NodeStatus, this feature makes node heartbeat significantly cheaper from both scalability and performance perspectives.
>

---

## API Objects

>
You can turn on and off the scheduling to a node with the kubectl cordon/uncordon commands.
>

```
kubectl cordon -h
Mark node as unschedulable.

Examples:
  # Mark node "foo" as unschedulable.
  kubectl cordon foo

Options:
      --dry-run=false: If true, only print the object that would be sent, without sending it.
  -l, --selector='': Selector (label query) to filter on

Usage:
  kubectl cordon NODE [options]

```

I've been using taint to turn on/off scheduling a node for a long time. 
This is quite handy. Good to know this.


So far, I've finished 7 section out of 17 from CNCF k8s Fundamentals.

I must say CNCF training system have lots of room for improvement.
Some of the quiz just broken, some of them with incorrect answer which will misleading the new learner. 
Some of them even have no answer, the system just kept telling me I was wrong even I tried the whole options. I've reported 2 issues in the class forum.