Who starts kube-apiserver and how to configure its start up parameters?

6/9/2020

The kube-apiserver is started by containerd.service in my configuration created by kubeadm init, how to check the configuration for containerd.service and how does it know how to start kube-apiserver?

ytong@controller-4135505:~$ systemctl status containerd.service
● containerd.service - containerd container runtime
   Loaded: loaded (/lib/systemd/system/containerd.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-06-09 04:34:04 GMT+7; 3min 24s ago
     Docs: https://containerd.io
  Process: 5135 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
 Main PID: 5138 (containerd)
    Tasks: 228
   CGroup: /system.slice/containerd.service
           ├─5138 /usr/bin/containerd
           ├─5821 etcd --advertise-client-urls=https://10.169.97.0:2379 --cert-file=/etc/kubernetes/pki/etcd/server.crt --client-cert-auth=true --data-dir=/var/lib/etcd --initial-advertise-
           ├─5847 kube-scheduler --authentication-kubeconfig=/etc/kubernetes/scheduler.conf --authorization-kubeconfig=/etc/kubernetes/scheduler.conf --bind-address=127.0.0.1 --kubeconfig=/
         * ├─5868 kube-apiserver --advertise-address=10.169.97.0 --allow-privileged=true --authorization-mode=Node,RBAC --client-ca-file=/etc/kubernetes/pki/ca.crt --enable-admission-plugin
           └─7587 kube-controller-manager --authentication-kubeconfig=/etc/kubernetes/controller-manager.conf --authorization-kubeconfig=/etc/kubernetes/controller-manager.conf --bind-addre```
And it is not controlled by kubelet.service right since I restart kubelet.service will not restart kube-apiserver daemon.

The only configuration file found by me for containerd.service is for /lib/systemd/system/containerd.service, but it only tell the execStart is /usr/bin/containerd.

The /usr/bin/containerd is a binary and all clues are ended here for me to find how it can find kube-apiserver to start.

Or does containerd has some path to hold its configuration files?
-- David Tong
kubernetes

1 Answer

6/9/2020

Kube API Server is started as static pod from a yaml located at /etc/kubernetes/manifests/kube-apiserver.yaml You can edit the yaml to add or remove startup parameter. Kubelet knows to look for any yaml in that path and if there is any yaml kubelet will delegate the container creation to containerd. So containerd does not directly know anything about Kubernetes API Server. For containerd Kubernetes API server is just another container to be started.

https://kubernetes.io/docs/reference/setup-tools/kubeadm/implementation-details/#constants-and-well-known-values-and-paths

-- Arghya Sadhu
Source: StackOverflow