gpt4 book ai didi

kubernetes - kube-apiserver 如何重启?

转载 作者:行者123 更新时间:2023-12-02 11:30:18 130 4
gpt4 key购买 nike

我今天重新启动了我的系统。之后,我的主系统和 Web 浏览器未连接以查找 kubernetes GUI。
当我运行命令时 systemctl status kube-apiserver.service ,
它给出如下所示的输出:

kube-apiserver.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
怎么可以 api-server重新启动?

最佳答案

您是否下载并安装了Kubernetes Controller Binaries直接地?
1) 如果是这样 , 检查 kube-apiserver.service systemd 单元文件存在:

cat /etc/systemd/system/kube-apiserver.service
2) 如果不是 ,你可能用 安装了 K8S .
通过此设置,kubeapi-server 作为 Pod 在主节点上运行 :
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 ..
而不是作为系统服务。
因此,由于您无法在 K8S 中重新启动 Pod,因此您必须将其删除:
kubectl delete pod/kube-apiserver-master-k8s -n kube-system
并且会立即创建一个新的 pod。

(*) 当您运行时 kubeadm init您应该会看到为控制平面创建 list 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"
.
.
对应的yaml:
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
以及 kube-apiserver 规范:
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
.
.
.

关于kubernetes - kube-apiserver 如何重启?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51666507/

130 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com