找回密码
 注册
查看: 14|回复: 0

kubeadm reset 集群以及kubeadm init 使用config文件重新初始化kubernetes集群

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2025-1-6 02:00:01 | 显示全部楼层 |阅读模式
kubernets先重置配置reset / H- a; n9 b5 j  S! W+ P" A$ ?" L* j3 Q
[root@k8s-master ~]# kubeadm reset --v=5 --cri-socket=unix:///var/run/cri-dockerd.sock : l( R# l& z2 j: O- `/ W7 r
I0103 22:43:08.557654   83642 reset.go:126] [reset] Could not obtain a client set from the kubeconfig file: /etc/kubernetes/admin.conf1 p' r6 l) D5 ?; t5 M9 h5 U9 F6 G
W0103 22:43:08.557782   83642 preflight.go:56] [reset] WARNING: Changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted.
1 e# b8 i7 t. _; a/ W[reset] Are you sure you want to proceed? [y/N]: Y
% e+ v7 b" ^6 P$ H" Q[preflight] Running pre-flight checks" d" `+ k0 L1 R# N4 z$ X
I0103 22:43:13.735565   83642 removeetcdmember.go:60] [reset] Checking for etcd config# f& x9 d8 l5 n
W0103 22:43:13.735621   83642 removeetcdmember.go:106] [reset] No kubeadm config, using etcd pod spec to get data directory
; R: H* f+ A8 _- ~+ ?/ uI0103 22:43:13.735774   83642 cleanupnode.go:65] [reset] Getting init system! w% P- k6 E$ b9 h2 t6 j6 [
[reset] Stopping the kubelet service- ~) o5 |3 b, |. n. h5 I
[reset] Unmounting mounted directories in "/var/lib/kubelet"* ]5 D4 z- H$ Y( I: b6 q" U
I0103 22:43:13.743121   83642 cleanupnode.go:103] [reset] Removing Kubernetes-managed containers/ U  a. v& \# Y5 B
[reset] Deleting contents of directories: [/etc/kubernetes/manifests /var/lib/kubelet /etc/kubernetes/pki]* o$ r# B% [, ]/ R
[reset] Deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/super-admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/bootstrap-kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf]. Q* v$ c9 }/ z. `2 {* n
. _# b6 Q; V' i: H
The reset process does not clean CNI configuration. To do so, you must remove /etc/cni/net.d2 ?" S% N0 F( n8 h( r
6 A- Q5 U# g1 V5 d. d+ g4 [8 @8 S
The reset process does not reset or clean up iptables rules or IPVS tables.
1 `" _2 n2 O+ W: SIf you wish to reset iptables, you must do so manually by using the "iptables" command.3 ]; S% o9 ]$ R& f

# ]6 Q" y3 z; V0 zIf your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar)
8 B2 Y4 s: ]; ~- ?to reset your system's IPVS tables.
; H# @  t9 |8 M( H: z
% N0 U, ]- A$ \7 K7 {The reset process does not clean your kubeconfig files and you must remove them manually.- N' e; ]4 E6 `6 A
Please, check the contents of the $HOME/.kube/config file.5 x. o2 U9 u2 i1 m; ]! J
( D' @  v2 C! f1 ~  a
重新通过文件初始化:
" b, J( ^! Z: Q
, @( L) ~* d  ?  q& _[root@k8s-master ~]# kubeadm init  --config=kubeadm-init-config.yaml  --v=5 --ignore-preflight-errors=SystemVerification & h  X# Q' t. U; T, l) n% `, ^$ [! ~: w
I0104 08:21:57.040996    3326 initconfiguration.go:261] loading configuration from "kubeadm-init-config.yaml"
5 R3 D% q( r" \' V0 o; LI0104 08:21:57.044966    3326 kubelet.go:195] the value of KubeletConfiguration.cgroupDriver is empty; setting it to "systemd"
$ V; ~4 t* N' B) }% \% @; k6 z[init] Using Kubernetes version: v1.31.08 |, ^& N" j8 K% O$ n& W+ H
[preflight] Running pre-flight checks8 V: T8 d. n5 h! r$ |0 L
I0104 08:21:57.050536    3326 checks.go:561] validating Kubernetes and kubeadm version- I" j: A+ e+ l( `; R
I0104 08:21:57.050579    3326 checks.go:166] validating if the firewall is enabled and active
. [/ F3 f; u/ {I0104 08:21:57.060446    3326 checks.go:201] validating availability of port 6443
7 O% l2 ~$ a& }I0104 08:21:57.060692    3326 checks.go:201] validating availability of port 10259. Y; r& x9 q5 w2 F# f
I0104 08:21:57.060939    3326 checks.go:201] validating availability of port 10257; O/ r2 b0 e0 e
I0104 08:21:57.061025    3326 checks.go:278] validating the existence of file /etc/kubernetes/manifests/kube-apiserver.yaml
' p& d8 h7 q- aI0104 08:21:57.061056    3326 checks.go:278] validating the existence of file /etc/kubernetes/manifests/kube-controller-manager.yaml
  Y: B* v' T  k$ X8 E/ MI0104 08:21:57.061107    3326 checks.go:278] validating the existence of file /etc/kubernetes/manifests/kube-scheduler.yaml
  F3 p. p8 g6 W" q$ _I0104 08:21:57.061147    3326 checks.go:278] validating the existence of file /etc/kubernetes/manifests/etcd.yaml4 O( N2 H4 K2 O7 U1 Y  G3 e
I0104 08:21:57.061183    3326 checks.go:428] validating if the connectivity type is via proxy or direct$ I0 a9 j0 S, s' E$ b6 X+ N% Y5 n) n
I0104 08:21:57.061246    3326 checks.go:467] validating http connectivity to first IP address in the CIDR
3 R( I7 g2 t6 Y3 EI0104 08:21:57.061353    3326 checks.go:467] validating http connectivity to first IP address in the CIDR
6 i, E9 W0 z( _& ~I0104 08:21:57.061375    3326 checks.go:102] validating the container runtime
8 _( x! v  b8 cI0104 08:21:57.062389    3326 checks.go:637] validating whether swap is enabled or not2 I) x9 [8 i$ W/ \. B' w' @
I0104 08:21:57.062579    3326 checks.go:368] validating the presence of executable crictl* p& `* }" F& g
I0104 08:21:57.062652    3326 checks.go:368] validating the presence of executable conntrack% I4 s  E+ y# c& l; h  L7 E
I0104 08:21:57.062709    3326 checks.go:368] validating the presence of executable ip
. j# b9 [! t6 dI0104 08:21:57.062777    3326 checks.go:368] validating the presence of executable iptables' O, _4 A& _# W9 s9 n# `- b
I0104 08:21:57.062850    3326 checks.go:368] validating the presence of executable mount
. o: |  g2 j" Q, e  PI0104 08:21:57.062979    3326 checks.go:368] validating the presence of executable nsenter7 J$ L; e. }4 B+ n! p
I0104 08:21:57.063051    3326 checks.go:368] validating the presence of executable ethtool
; q, G# N. F, v# PI0104 08:21:57.063123    3326 checks.go:368] validating the presence of executable tc! [' B# I* |5 Y1 V, A! o- B
I0104 08:21:57.063178    3326 checks.go:368] validating the presence of executable touch
5 ^, n& \0 m, u, n  U: YI0104 08:21:57.063261    3326 checks.go:514] running all checks: Y1 K, u2 P1 f6 U0 k
[preflight] The system verification failed. Printing the output from the verification:
; o' a) {  a0 O' gKERNEL_VERSION: 4.18.16x86-4.18-16# R! p) Z9 M, b! W. L, o
OS: Linux& F- f5 z) k' U9 J' [0 o
CGROUPS_CPU: enabled
1 M- j6 n: r  o+ o2 f% qCGROUPS_CPUACCT: enabled1 f8 N) s( H" H! {
CGROUPS_CPUSET: enabled
; k) t" k' E  O! }! Q- m8 gCGROUPS_DEVICES: enabled/ W6 R+ ^+ ?2 {+ y: J2 k0 M
CGROUPS_FREEZER: enabled
& D( R1 V/ U* w; A9 P, v! R. XCGROUPS_MEMORY: enabled
( A+ X5 s, S9 _- n1 M: uCGROUPS_PIDS: enabled
  G% o! ]2 o8 C& Q) z# Y- SCGROUPS_HUGETLB: enabled
. Y, t2 C2 w, r9 l/ w1 ACGROUPS_BLKIO: enabled# h; |7 Y& a! G
        [WARNING SystemVerification]: failed to parse kernel config: unable to load kernel module: "configs", output: "modprobe: FATAL: Module configs not found.\n", err: exit status 1
. u- F8 P6 p. J3 o5 G8 Y9 e( sI0104 08:21:57.069077    3326 checks.go:399] checking whether the given node name is valid and reachable using net.LookupHost2 B% Y  X! F+ Q9 A0 Q8 E6 R
        [WARNING Hostname]: hostname "node" could not be reached" c" U/ t) S3 }9 K# @& V
        [WARNING Hostname]: hostname "node": lookup node on 202.106.0.20:53: no such host
. p3 n" e' X4 w8 G( G8 t: s6 }I0104 08:21:57.075047    3326 checks.go:603] validating kubelet version
  |2 a9 |! e; T9 k7 oI0104 08:21:57.148436    3326 checks.go:128] validating if the "kubelet" service is enabled and active
" n7 X6 m1 U0 z  J- Y3 y0 x0 hI0104 08:21:57.159069    3326 checks.go:201] validating availability of port 10250
6 U# ^& N5 }; S$ k! {7 ]I0104 08:21:57.159163    3326 checks.go:327] validating the contents of file /proc/sys/net/ipv4/ip_forward
  J. i0 J- k9 G# L: X/ y6 C# jI0104 08:21:57.159232    3326 checks.go:201] validating availability of port 2379
2 `" z  q; v+ jI0104 08:21:57.159292    3326 checks.go:201] validating availability of port 2380& w' Q1 p( \  g% t7 V* t7 Y
I0104 08:21:57.159451    3326 checks.go:241] validating the existence and emptiness of directory /var/lib/etcd3 T: Z5 v# A! j! q( V) `' W
[preflight] Pulling images required for setting up a Kubernetes cluster# v7 |$ I; Q7 K2 }1 l2 W/ X$ L( Q* w
[preflight] This might take a minute or two, depending on the speed of your internet connection# y* ?# i7 ]3 O# @7 a, v8 H
[preflight] You can also perform this action beforehand using 'kubeadm config images pull'
( e, H  {# ^0 U: @, f6 x2 NI0104 08:21:57.162812    3326 checks.go:832] using image pull policy: IfNotPresent  l& @# X2 B2 ^% C! Z" O% H4 I
W0104 08:21:57.163929    3326 checks.go:846] detected that the sandbox image "registry.k8s.io/pause:3.6" of the container runtime is inconsistent with that used by kubeadm.It is recommended to use "registry.aliyuncs.com/google_containers/pause:3.10" as the CRI sandbox image.
+ A0 ^( v% f- ~I0104 08:21:57.164932    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/kube-apiserver:v1.31.0
  {) r+ r6 }. O' FI0104 08:22:03.825498    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/kube-controller-manager:v1.31.0
/ @  I2 h) f1 w: CI0104 08:22:09.870677    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/kube-scheduler:v1.31.0; v2 @2 t/ g' V/ r) k
I0104 08:22:14.792245    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/kube-proxy:v1.31.0
. g# t2 j, ~5 d$ uI0104 08:22:21.833498    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/coredns:v1.11.3
0 N% j. f1 b2 ?; HI0104 08:22:26.694562    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/pause:3.10& [9 d* d, i/ g% q2 @, M! ~  b* g
I0104 08:22:27.874314    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/etcd:3.5.15-0
# p9 G6 n  V, m5 s( s) t! f[certs] Using certificateDir folder "/etc/kubernetes/pki"2 C2 U( N$ }1 m  N+ ]( J
I0104 08:22:38.609775    3326 certs.go:112] creating a new certificate authority for ca( Q+ J. C/ J/ v7 @9 P- L  s
[certs] Generating "ca" certificate and key
/ f" m, [' U! y, c3 x5 qI0104 08:22:39.795060    3326 certs.go:473] validating certificate period for ca certificate
. W' |1 ?! o' V1 z[certs] Generating "apiserver" certificate and key/ k) a9 q2 I' ]: A: n! b( q4 X
[certs] apiserver serving cert is signed for DNS names [kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local node] and IPs [172.29.16.1 1.2.3.4]7 I2 Z& E6 ], ?1 A0 `- r$ |. p
[certs] Generating "apiserver-kubelet-client" certificate and key& `- L$ t+ v9 X
I0104 08:22:40.424934    3326 certs.go:112] creating a new certificate authority for front-proxy-ca. t; B/ S! z/ i; C" F! g' A0 {3 _
[certs] Generating "front-proxy-ca" certificate and key/ F" J7 a* Y# A0 {
I0104 08:22:40.745566    3326 certs.go:473] validating certificate period for front-proxy-ca certificate
* J( @4 d' _! N$ b' F9 I) a[certs] Generating "front-proxy-client" certificate and key
9 [8 a( T- s" D# B% \I0104 08:22:41.527532    3326 certs.go:112] creating a new certificate authority for etcd-ca" w. H) l5 J; k6 {4 ~, h% U- R4 R$ F4 ?
[certs] Generating "etcd/ca" certificate and key% i! {0 `3 L. s) Z! ]+ S" A2 M
I0104 08:22:42.751929    3326 certs.go:473] validating certificate period for etcd/ca certificate  h0 Q- X% K( U( R& |# S
[certs] Generating "etcd/server" certificate and key2 [' J: y, E$ O: `
[certs] etcd/server serving cert is signed for DNS names [localhost node] and IPs [1.2.3.4 127.0.0.1 ::1]
1 ^2 R  M' ?/ Y3 e5 I[certs] Generating "etcd/peer" certificate and key; z! N/ E: A" J8 s' C5 s
[certs] etcd/peer serving cert is signed for DNS names [localhost node] and IPs [1.2.3.4 127.0.0.1 ::1]
' ?& B0 O$ U7 n3 l# T. h0 ?[certs] Generating "etcd/healthcheck-client" certificate and key
$ H9 L( z1 z, o% }& x( B[certs] Generating "apiserver-etcd-client" certificate and key
8 J( ]$ @+ E! i# R; k" uI0104 08:22:45.579717    3326 certs.go:78] creating new public/private key files for signing service account users
0 y: I% U. N8 F5 d1 W  b; E[certs] Generating "sa" key and public key3 D* Y# ?0 ~, Y; m  X9 r
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"8 L8 V  k6 Y+ [$ D  ^5 o
I0104 08:22:45.821509    3326 kubeconfig.go:111] creating kubeconfig file for admin.conf- m8 q$ @9 w( K$ Y
[kubeconfig] Writing "admin.conf" kubeconfig file
  u/ w) B' \0 ~6 C  V0 FI0104 08:22:46.146568    3326 kubeconfig.go:111] creating kubeconfig file for super-admin.conf
; R, ~5 D" V5 z+ e2 Q  t7 A[kubeconfig] Writing "super-admin.conf" kubeconfig file2 Q6 ]4 F! W! C6 C
I0104 08:22:46.913876    3326 kubeconfig.go:111] creating kubeconfig file for kubelet.conf
' A- g" k+ i3 i# d9 E% I5 i[kubeconfig] Writing "kubelet.conf" kubeconfig file
  F  R8 M3 V! `% v: A' w; P1 ?I0104 08:22:47.189373    3326 kubeconfig.go:111] creating kubeconfig file for controller-manager.conf
2 L8 \% O0 A' g7 ~3 O8 Y[kubeconfig] Writing "controller-manager.conf" kubeconfig file% {6 r3 o3 W' Z' G* \+ E( X
I0104 08:22:47.789782    3326 kubeconfig.go:111] creating kubeconfig file for scheduler.conf6 y7 n# R0 X/ H2 c5 D
[kubeconfig] Writing "scheduler.conf" kubeconfig file7 g2 b1 E, T' C" ]5 Q( [8 t4 B
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests") w+ e# r1 G; r/ f% E+ T
I0104 08:22:48.176199    3326 local.go:65] [etcd] wrote Static Pod manifest for a local etcd member to "/etc/kubernetes/manifests/etcd.yaml"
5 h8 j8 b" s" M  u7 e[control-plane] Using manifest folder "/etc/kubernetes/manifests"& e/ o& J) {, M6 H
[control-plane] Creating static Pod manifest for "kube-apiserver"
6 Q) Q: U" E4 P# b9 W0 S- XI0104 08:22:48.176664    3326 manifests.go:103] [control-plane] getting StaticPodSpecs
; ]/ w# m# K2 E$ |0 v/ nI0104 08:22:48.177133    3326 certs.go:473] validating certificate period for CA certificate1 }! c/ h9 {% M) y5 ^2 q
I0104 08:22:48.177225    3326 manifests.go:129] [control-plane] adding volume "ca-certs" for component "kube-apiserver"; u" j* W, P9 v8 n) a7 V4 ?% y, u
I0104 08:22:48.177245    3326 manifests.go:129] [control-plane] adding volume "etc-pki-ca-trust" for component "kube-apiserver", }$ J4 ?* C( [4 p$ m
I0104 08:22:48.177257    3326 manifests.go:129] [control-plane] adding volume "etc-pki-tls-certs" for component "kube-apiserver"8 B  `, C. j% G) j, y
I0104 08:22:48.177270    3326 manifests.go:129] [control-plane] adding volume "k8s-certs" for component "kube-apiserver"" J5 I6 B4 T7 W! j
I0104 08:22:48.178627    3326 manifests.go:158] [control-plane] wrote static Pod manifest for component "kube-apiserver" to "/etc/kubernetes/manifests/kube-apiserver.yaml"9 k# k. T* d$ x/ y; r  V+ ?, k. m( Y/ z
[control-plane] Creating static Pod manifest for "kube-controller-manager"
( @5 v& |( D8 d5 gI0104 08:22:48.178653    3326 manifests.go:103] [control-plane] getting StaticPodSpecs
/ p7 C# R* _, W4 K8 K! ?# YI0104 08:22:48.178973    3326 manifests.go:129] [control-plane] adding volume "ca-certs" for component "kube-controller-manager"
* D$ R$ g" G5 t! ]; _& F- U6 S0 R6 TI0104 08:22:48.178993    3326 manifests.go:129] [control-plane] adding volume "etc-pki-ca-trust" for component "kube-controller-manager"5 Q( A% N+ F0 L2 a" M" i6 I) v
I0104 08:22:48.179005    3326 manifests.go:129] [control-plane] adding volume "etc-pki-tls-certs" for component "kube-controller-manager"0 j9 J6 G( M& @5 i
I0104 08:22:48.179018    3326 manifests.go:129] [control-plane] adding volume "flexvolume-dir" for component "kube-controller-manager"2 _% D, B, r- \# g* d
I0104 08:22:48.179030    3326 manifests.go:129] [control-plane] adding volume "k8s-certs" for component "kube-controller-manager", w2 x+ ^" e  a, o/ ~7 E5 W$ G' T
I0104 08:22:48.179043    3326 manifests.go:129] [control-plane] adding volume "kubeconfig" for component "kube-controller-manager"( q! t& r# f( C6 Z. N8 P
I0104 08:22:48.180113    3326 manifests.go:158] [control-plane] wrote static Pod manifest for component "kube-controller-manager" to "/etc/kubernetes/manifests/kube-controller-manager.yaml"1 |. l/ G0 d1 @+ S- g0 g$ G# j
[control-plane] Creating static Pod manifest for "kube-scheduler"
, P+ b* i( Z/ o; r8 m# rI0104 08:22:48.180140    3326 manifests.go:103] [control-plane] getting StaticPodSpecs
( m# J0 B; k3 N/ R- {4 jI0104 08:22:48.180470    3326 manifests.go:129] [control-plane] adding volume "kubeconfig" for component "kube-scheduler"
7 W2 C- X, X! ~& Z3 AI0104 08:22:48.181362    3326 manifests.go:158] [control-plane] wrote static Pod manifest for component "kube-scheduler" to "/etc/kubernetes/manifests/kube-scheduler.yaml"
" e9 b; j! n: c! u+ L% i# qI0104 08:22:48.181506    3326 kubelet.go:68] Stopping the kubelet0 V& }6 t; b- X9 x3 M
I0104 08:22:48.194634    3326 flags.go:101] setting kubelet hostname-override to "node"
( K; q' K) m1 C, g/ A0 ~  S5 Z! r[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
6 `( B( U+ b0 ^[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
7 G2 L" r, `# g+ ^[kubelet-start] Starting the kubelet
9 o3 y2 l4 f( R/ M' L+ [# L& c2 O" f[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests"
; Y  X- E( S6 n0 |- r* q, j' K[kubelet-check] Waiting for a healthy kubelet at http://127.0.0.1:10248/healthz. This can take up to 4m0s$ u( w8 Y0 x% n1 V: i, S4 S  F1 D
[kubelet-check] The kubelet is healthy after 2.502312387s
9 C0 }" t) X6 m) P/ E( q1 o( }[api-check] Waiting for a healthy API server. This can take up to 4m0s- `- `$ L4 S4 k2 h1 m* A, _4 ~# _" \

3 C7 J+ p5 _; ^0 L  s# v$ ]7 C/ |* e' W! o, F3 i* y, a
9 \6 x4 _2 }" z0 g6 ~! I- {. ]
2 p) P$ j9 y0 M# p3 O
4 R/ X1 u/ r0 C  f8 z% L

3 H  v: J$ a0 F
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:28 , Processed in 0.016437 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表