Did you download and installed the Kubernetes Controller Binaries directly?
1 ) If so, check if the kube-apiserver.service
systemd unit file exists:
cat /etc/systemd/system/kube-apiserver.service
2 ) If not, you probably installed K8S with kubeadm.
With this setup the kubeapi-server is running as a pod on the master node:
kubectl get pods -n kube-system
NAME READY STATUS
coredns-f9fd979d6-jsn6w 1/1 Running ..
coredns-f9fd979d6-tv5j6 1/1 Running ..
etcd-master-k8s 1/1 Running ..
kube-apiserver-master-k8s 1/1 Running .. #<--- Here
kube-controller-manager-master-k8s 1/1 Running ..
kube-proxy-5kzbc 1/1 Running ..
kube-scheduler-master-k8s 1/1 Running ..
And not as a systemd service.
So, because you can't restart pods in K8S you'll have to delete it:
kubectl delete pod/kube-apiserver-master-k8s -n kube-system
And a new pod will be created immediately.
(*) When you run kubeadm init you should see the creation of the manifests for the control plane static Pods:
.
.
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
.
.
The corresponding yamls:
ubuntu@master-k8s:/etc/kubernetes/manifests$ ls -la
total 24
drwxr-xr-x 2 root root 4096 Oct 14 00:13 .
drwxr-xr-x 4 root root 4096 Sep 29 02:30 ..
-rw------- 1 root root 2099 Sep 29 02:30 etcd.yaml
-rw------- 1 root root 3863 Oct 14 00:13 kube-apiserver.yaml <----- Here
-rw------- 1 root root 3496 Sep 29 02:30 kube-controller-manager.yaml
-rw------- 1 root root 1384 Sep 29 02:30 kube-scheduler.yaml
And the kube-apiserver spec:
apiVersion: v1
kind: Pod
metadata:
annotations:
kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 10.100.102.5:6443
creationTimestamp: null
labels:
component: kube-apiserver
tier: control-plane
name: kube-apiserver
namespace: kube-system
spec:
containers:
- command:
- kube-apiserver
- --advertise-address=10.100.102.5
- --allow-privileged=true
- --authorization-mode=Node,RBAC
- --client-ca-file=/etc/kubernetes/pki/ca.crt
- --enable-admission-plugins=NodeRestriction
- --enable-bootstrap-token-auth=true
.
.
.