易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 6|回复: 0
收起左侧

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

[复制链接]
发表于 2025-1-6 02:00:01 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
kubernets先重置配置reset
( G8 I  T/ J6 [, _$ u" `" G% w& s[root@k8s-master ~]# kubeadm reset --v=5 --cri-socket=unix:///var/run/cri-dockerd.sock
, K* \8 E! |& ~7 w/ q4 T3 W' gI0103 22:43:08.557654   83642 reset.go:126] [reset] Could not obtain a client set from the kubeconfig file: /etc/kubernetes/admin.conf8 s* ]/ f2 E+ v# R' w( U+ y+ c' v( l
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 V1 x9 Y; l. ~* V  B' G[reset] Are you sure you want to proceed? [y/N]: Y2 _! D  b2 e1 ~! \/ g
[preflight] Running pre-flight checks
- S8 `- n' k3 W* O3 R: r# mI0103 22:43:13.735565   83642 removeetcdmember.go:60] [reset] Checking for etcd config
+ b5 i2 k( }* s' B% ?W0103 22:43:13.735621   83642 removeetcdmember.go:106] [reset] No kubeadm config, using etcd pod spec to get data directory
% W* O! G7 Z7 H3 v3 [I0103 22:43:13.735774   83642 cleanupnode.go:65] [reset] Getting init system
: A  q0 A7 H' Q' D3 m  n[reset] Stopping the kubelet service
" F% X7 \; t9 z- v5 S$ e0 J' V[reset] Unmounting mounted directories in "/var/lib/kubelet"
/ n- L* M  u$ f, y$ Q: oI0103 22:43:13.743121   83642 cleanupnode.go:103] [reset] Removing Kubernetes-managed containers9 R( r5 Q+ f. K# R2 s# |% Y
[reset] Deleting contents of directories: [/etc/kubernetes/manifests /var/lib/kubelet /etc/kubernetes/pki]( m# d7 w3 o% c" {  |* i. ?
[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]
: y2 b( }$ [2 I0 p% Z1 y  Z7 s
1 C' l3 Z/ C9 d1 ^: Y$ t" P: U; IThe reset process does not clean CNI configuration. To do so, you must remove /etc/cni/net.d. y* H6 N" @  F* Z& c
3 R- Q4 u# `9 `- Y" e5 E
The reset process does not reset or clean up iptables rules or IPVS tables.: W1 Z8 L; i1 y; J! s- V- ]
If you wish to reset iptables, you must do so manually by using the "iptables" command.
' ?& m* T+ R. q; H1 x, c5 c4 d6 C( x
If your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar)$ @: H+ t* ?' V/ r! h$ F$ k
to reset your system's IPVS tables.3 s- f" w0 j2 H1 A! L/ q1 X& D

& o0 N! I( B+ Q1 e. i' I' MThe reset process does not clean your kubeconfig files and you must remove them manually.( s9 q' U$ ]9 V0 U) F, t( l- Q
Please, check the contents of the $HOME/.kube/config file.
6 C# x$ r" U5 D2 g  a/ W9 T
& R3 w& T2 D5 s8 W/ x) t重新通过文件初始化:
! l3 g9 m6 R, _+ q# ~7 {1 o5 a8 M! d' E/ D. r3 f4 z6 a
[root@k8s-master ~]# kubeadm init  --config=kubeadm-init-config.yaml  --v=5 --ignore-preflight-errors=SystemVerification $ s0 z! e" A9 y- C3 `' m, r. n
I0104 08:21:57.040996    3326 initconfiguration.go:261] loading configuration from "kubeadm-init-config.yaml"4 u1 d  P2 F; e, `6 i5 r8 C  Z0 H
I0104 08:21:57.044966    3326 kubelet.go:195] the value of KubeletConfiguration.cgroupDriver is empty; setting it to "systemd". h. B: @2 Y$ d  I1 I
[init] Using Kubernetes version: v1.31.0, d. ]0 m8 F" o
[preflight] Running pre-flight checks- j+ g% d( p+ \$ y4 O! n2 S
I0104 08:21:57.050536    3326 checks.go:561] validating Kubernetes and kubeadm version
/ b6 z8 T' {% ~) lI0104 08:21:57.050579    3326 checks.go:166] validating if the firewall is enabled and active( `' v0 N  i1 k
I0104 08:21:57.060446    3326 checks.go:201] validating availability of port 6443
( x5 h8 \1 T+ H, X7 K  rI0104 08:21:57.060692    3326 checks.go:201] validating availability of port 102592 S2 Q0 J4 `! S" w/ g, u
I0104 08:21:57.060939    3326 checks.go:201] validating availability of port 10257
. o& G4 q$ `. J$ I! l  e, JI0104 08:21:57.061025    3326 checks.go:278] validating the existence of file /etc/kubernetes/manifests/kube-apiserver.yaml" Z, f/ r) {& o$ k$ d3 C
I0104 08:21:57.061056    3326 checks.go:278] validating the existence of file /etc/kubernetes/manifests/kube-controller-manager.yaml
+ \! ?/ i" J7 u2 C+ yI0104 08:21:57.061107    3326 checks.go:278] validating the existence of file /etc/kubernetes/manifests/kube-scheduler.yaml
4 W( ^* d5 m" _& ~  oI0104 08:21:57.061147    3326 checks.go:278] validating the existence of file /etc/kubernetes/manifests/etcd.yaml: E' [7 }+ x; C* K1 K' v
I0104 08:21:57.061183    3326 checks.go:428] validating if the connectivity type is via proxy or direct
: F/ F; T/ @& w& f: u; y! Z9 A  @I0104 08:21:57.061246    3326 checks.go:467] validating http connectivity to first IP address in the CIDR: J& f- o" E; z% [
I0104 08:21:57.061353    3326 checks.go:467] validating http connectivity to first IP address in the CIDR
( F6 H. a4 _" }I0104 08:21:57.061375    3326 checks.go:102] validating the container runtime
2 p8 h$ Y" z) z6 y/ d: AI0104 08:21:57.062389    3326 checks.go:637] validating whether swap is enabled or not
5 `# ^1 ^  @" }" @2 Y9 ?% i% UI0104 08:21:57.062579    3326 checks.go:368] validating the presence of executable crictl
2 L) W. d: b8 }I0104 08:21:57.062652    3326 checks.go:368] validating the presence of executable conntrack) ~! ~2 b0 G2 d, M- g7 s% V. Y# _: a, f
I0104 08:21:57.062709    3326 checks.go:368] validating the presence of executable ip
: ]4 H, B) V! b7 iI0104 08:21:57.062777    3326 checks.go:368] validating the presence of executable iptables  \" y& ?0 I( A
I0104 08:21:57.062850    3326 checks.go:368] validating the presence of executable mount
' @) k+ Z) ]7 ?) S, eI0104 08:21:57.062979    3326 checks.go:368] validating the presence of executable nsenter
+ |! s9 F5 ~+ z( R6 a  XI0104 08:21:57.063051    3326 checks.go:368] validating the presence of executable ethtool
4 B4 Z: @# @  N4 g9 ?I0104 08:21:57.063123    3326 checks.go:368] validating the presence of executable tc- m# E" N6 i0 v5 F
I0104 08:21:57.063178    3326 checks.go:368] validating the presence of executable touch
2 L' D  L' O9 h8 |' u  r# i) @/ {) V( hI0104 08:21:57.063261    3326 checks.go:514] running all checks
; X8 p6 X- ?0 C. O$ D1 X[preflight] The system verification failed. Printing the output from the verification:
  q! P! k3 K. c- ?; w7 E1 S# QKERNEL_VERSION: 4.18.16x86-4.18-16# v( G* [! L2 c* N
OS: Linux
" l  b' B  J: G8 }, k2 R% S$ \! mCGROUPS_CPU: enabled( x4 s4 K2 u. `' i0 _; H4 j# O
CGROUPS_CPUACCT: enabled
; m: x; m6 N% K! P$ SCGROUPS_CPUSET: enabled
- d! {) ^" K* e8 p% f% M" b5 dCGROUPS_DEVICES: enabled
* J( h1 X; W$ N! x& Q( oCGROUPS_FREEZER: enabled0 J7 y9 D. p. E" t$ h
CGROUPS_MEMORY: enabled, |: E7 n  W! F4 D
CGROUPS_PIDS: enabled
! ^5 I- R$ `4 A  y' ]: B5 H& ?CGROUPS_HUGETLB: enabled3 g# E2 o& }# m- o
CGROUPS_BLKIO: enabled
$ J3 _9 G! {& \  S' h        [WARNING SystemVerification]: failed to parse kernel config: unable to load kernel module: "configs", output: "modprobe: FATAL: Module configs not found.\n", err: exit status 19 `; h6 G) O1 d: ?, X
I0104 08:21:57.069077    3326 checks.go:399] checking whether the given node name is valid and reachable using net.LookupHost
$ j- M' H2 A) @  J" W. A        [WARNING Hostname]: hostname "node" could not be reached
8 ^- M0 w. V- N4 ~& u9 g) n        [WARNING Hostname]: hostname "node": lookup node on 202.106.0.20:53: no such host( r( }1 h5 g, I: h- N
I0104 08:21:57.075047    3326 checks.go:603] validating kubelet version
: D1 ~2 l9 q4 A3 Z3 NI0104 08:21:57.148436    3326 checks.go:128] validating if the "kubelet" service is enabled and active: M, Q0 j' l* b- K0 @
I0104 08:21:57.159069    3326 checks.go:201] validating availability of port 10250
! U! U8 \* A7 [+ `; zI0104 08:21:57.159163    3326 checks.go:327] validating the contents of file /proc/sys/net/ipv4/ip_forward3 W8 Y) s7 P  ~0 f
I0104 08:21:57.159232    3326 checks.go:201] validating availability of port 23792 d: m& I- C3 k  h. ^: y1 N
I0104 08:21:57.159292    3326 checks.go:201] validating availability of port 2380
0 h4 B* w: f+ }- }# BI0104 08:21:57.159451    3326 checks.go:241] validating the existence and emptiness of directory /var/lib/etcd
& ?3 p  `5 Q& g+ X; A7 h0 Z[preflight] Pulling images required for setting up a Kubernetes cluster! g+ P) h8 t8 I% E( j3 Q/ S- k' |5 O6 a
[preflight] This might take a minute or two, depending on the speed of your internet connection  V/ A9 b) R% R9 M0 x
[preflight] You can also perform this action beforehand using 'kubeadm config images pull'9 n" g2 w) m0 i0 K$ `( i
I0104 08:21:57.162812    3326 checks.go:832] using image pull policy: IfNotPresent
7 a) C" E/ Z( q" [" V# iW0104 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.
8 f1 C+ l) y) }6 U! t, B2 BI0104 08:21:57.164932    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/kube-apiserver:v1.31.0  T' d* ?8 Z! ]: L, ]3 M$ Z
I0104 08:22:03.825498    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/kube-controller-manager:v1.31.0- C/ ^- M+ Q2 p7 F
I0104 08:22:09.870677    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/kube-scheduler:v1.31.0* ^, ~' \1 Z% N) a* B
I0104 08:22:14.792245    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/kube-proxy:v1.31.0
7 o8 V- Z+ f7 k! JI0104 08:22:21.833498    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/coredns:v1.11.3+ j( ^7 Y7 k( U8 M
I0104 08:22:26.694562    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/pause:3.10
/ x8 F" M+ }% x' q6 l0 `/ M* j) WI0104 08:22:27.874314    3326 checks.go:871] pulling: registry.aliyuncs.com/google_containers/etcd:3.5.15-0- f" Y- C& I$ g  L
[certs] Using certificateDir folder "/etc/kubernetes/pki"6 n2 }% g- K( _, u- u
I0104 08:22:38.609775    3326 certs.go:112] creating a new certificate authority for ca
, N' Z) G$ s: _[certs] Generating "ca" certificate and key
: ?* w5 R5 @( a$ s0 }" ]I0104 08:22:39.795060    3326 certs.go:473] validating certificate period for ca certificate- D6 d2 B* `- V4 l
[certs] Generating "apiserver" certificate and key6 U4 Q: H6 A/ d' t
[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]
' Z; p( e) n! n" S/ J. p[certs] Generating "apiserver-kubelet-client" certificate and key# N) C1 ]; ?$ T+ k9 d# Y
I0104 08:22:40.424934    3326 certs.go:112] creating a new certificate authority for front-proxy-ca$ `  u0 x( y0 ]4 ^2 {7 \) [1 h* C" K
[certs] Generating "front-proxy-ca" certificate and key
- @+ t# I5 c3 C( E; zI0104 08:22:40.745566    3326 certs.go:473] validating certificate period for front-proxy-ca certificate
: M8 ^* F8 o+ v$ v% i" @% K[certs] Generating "front-proxy-client" certificate and key+ g' q9 R  {- L$ l% d
I0104 08:22:41.527532    3326 certs.go:112] creating a new certificate authority for etcd-ca
8 d9 c1 z, a" m( g; U7 j. }[certs] Generating "etcd/ca" certificate and key
* j, }* \. ~4 U5 fI0104 08:22:42.751929    3326 certs.go:473] validating certificate period for etcd/ca certificate
8 q$ s* ^6 [& J9 |[certs] Generating "etcd/server" certificate and key9 d1 [+ I$ i' w; z1 x
[certs] etcd/server serving cert is signed for DNS names [localhost node] and IPs [1.2.3.4 127.0.0.1 ::1]# r* W8 d' ]' c, {. U
[certs] Generating "etcd/peer" certificate and key1 T5 c& L/ d) K; i
[certs] etcd/peer serving cert is signed for DNS names [localhost node] and IPs [1.2.3.4 127.0.0.1 ::1]: p; }; S6 y; l# p. e7 {
[certs] Generating "etcd/healthcheck-client" certificate and key$ C* b* _1 I# o2 s
[certs] Generating "apiserver-etcd-client" certificate and key
# q+ e, ?" S! y, Y$ FI0104 08:22:45.579717    3326 certs.go:78] creating new public/private key files for signing service account users
5 H1 l# Q6 @7 Y) `6 U$ J7 V$ b[certs] Generating "sa" key and public key2 I* }7 W3 r# S, K
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
, I" Q+ i$ V/ W5 c! W3 w' G6 q2 JI0104 08:22:45.821509    3326 kubeconfig.go:111] creating kubeconfig file for admin.conf: O, s9 M' u" U, L% Y
[kubeconfig] Writing "admin.conf" kubeconfig file
8 Z( B# J0 o' m8 h7 h! ~5 }I0104 08:22:46.146568    3326 kubeconfig.go:111] creating kubeconfig file for super-admin.conf: }! Y/ K  y  t. x
[kubeconfig] Writing "super-admin.conf" kubeconfig file
8 Z' y% [5 t) {& c2 pI0104 08:22:46.913876    3326 kubeconfig.go:111] creating kubeconfig file for kubelet.conf& Z' v( ^2 J" V/ Y5 s( F
[kubeconfig] Writing "kubelet.conf" kubeconfig file$ ?8 u) z: I  y! E" ^) N
I0104 08:22:47.189373    3326 kubeconfig.go:111] creating kubeconfig file for controller-manager.conf" g8 w- p0 J# N5 @# n! J9 [2 h
[kubeconfig] Writing "controller-manager.conf" kubeconfig file( B- v7 f# K" \& F8 R# N, E0 @
I0104 08:22:47.789782    3326 kubeconfig.go:111] creating kubeconfig file for scheduler.conf
: M$ }  P3 k/ M1 P+ z: {[kubeconfig] Writing "scheduler.conf" kubeconfig file
; e5 N7 b+ u+ y: B2 b[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
7 j' A" q3 Y: a% [5 I7 XI0104 08:22:48.176199    3326 local.go:65] [etcd] wrote Static Pod manifest for a local etcd member to "/etc/kubernetes/manifests/etcd.yaml"
) p8 w+ N( \+ \+ i6 E2 @) f, z[control-plane] Using manifest folder "/etc/kubernetes/manifests"
$ Q( x) n; `+ e8 B& v0 H[control-plane] Creating static Pod manifest for "kube-apiserver"
4 r' m! E, Q( i+ R1 ~  a8 ^0 KI0104 08:22:48.176664    3326 manifests.go:103] [control-plane] getting StaticPodSpecs
1 s& |% A4 M3 L) p# `1 f, L* f* A1 X  lI0104 08:22:48.177133    3326 certs.go:473] validating certificate period for CA certificate
& J, N& K- ]) D# T; r. m1 A- ]/ SI0104 08:22:48.177225    3326 manifests.go:129] [control-plane] adding volume "ca-certs" for component "kube-apiserver"+ W2 d: n$ H3 W3 j
I0104 08:22:48.177245    3326 manifests.go:129] [control-plane] adding volume "etc-pki-ca-trust" for component "kube-apiserver"
" d, h* y4 \  ^- p; W& ^I0104 08:22:48.177257    3326 manifests.go:129] [control-plane] adding volume "etc-pki-tls-certs" for component "kube-apiserver"9 f3 h8 k) u1 H  O- f
I0104 08:22:48.177270    3326 manifests.go:129] [control-plane] adding volume "k8s-certs" for component "kube-apiserver"' r- R( f' a7 i* v
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"
6 P# N6 ?- {4 P) r2 M0 A, f2 _3 @, k[control-plane] Creating static Pod manifest for "kube-controller-manager"* `& z: z% }6 W$ U& @/ t" @9 P) P! U1 T
I0104 08:22:48.178653    3326 manifests.go:103] [control-plane] getting StaticPodSpecs
1 e+ M9 W) T* z. f) C& P+ eI0104 08:22:48.178973    3326 manifests.go:129] [control-plane] adding volume "ca-certs" for component "kube-controller-manager"  w8 _0 i& f& x( F
I0104 08:22:48.178993    3326 manifests.go:129] [control-plane] adding volume "etc-pki-ca-trust" for component "kube-controller-manager"
* t' j! w, K; {: a3 K' LI0104 08:22:48.179005    3326 manifests.go:129] [control-plane] adding volume "etc-pki-tls-certs" for component "kube-controller-manager"
: `& ~  o/ [# ~I0104 08:22:48.179018    3326 manifests.go:129] [control-plane] adding volume "flexvolume-dir" for component "kube-controller-manager"
) E' B: [8 W- l- t: \' OI0104 08:22:48.179030    3326 manifests.go:129] [control-plane] adding volume "k8s-certs" for component "kube-controller-manager"3 _5 j+ T" h$ j% b$ D& f& |
I0104 08:22:48.179043    3326 manifests.go:129] [control-plane] adding volume "kubeconfig" for component "kube-controller-manager"
$ [, d: k, ?; x! t: H7 c! ^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"0 ?7 D0 {3 l5 U2 M
[control-plane] Creating static Pod manifest for "kube-scheduler"* h+ U, w- |6 d$ @% Y* i5 G: h& K
I0104 08:22:48.180140    3326 manifests.go:103] [control-plane] getting StaticPodSpecs' z* _7 i0 y# E
I0104 08:22:48.180470    3326 manifests.go:129] [control-plane] adding volume "kubeconfig" for component "kube-scheduler"
' o* o7 B6 M( sI0104 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"
  K1 Q, t8 R; @' d1 E: cI0104 08:22:48.181506    3326 kubelet.go:68] Stopping the kubelet8 {( r* p5 P" I
I0104 08:22:48.194634    3326 flags.go:101] setting kubelet hostname-override to "node"
! j! s3 n$ h; A: K, G$ F) R' f[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
; V8 F4 V+ t+ k* _3 h2 n8 v[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml": b) M0 c; |9 c! o
[kubelet-start] Starting the kubelet
$ N6 M( E( K* O! n. F6 R5 ?[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests"' P3 q; z. l1 f8 I0 {6 v
[kubelet-check] Waiting for a healthy kubelet at http://127.0.0.1:10248/healthz. This can take up to 4m0s7 C  O" D! n8 w- u; {; A. @/ T$ i) |
[kubelet-check] The kubelet is healthy after 2.502312387s
/ T6 F9 j2 O' {* m[api-check] Waiting for a healthy API server. This can take up to 4m0s
/ t  U& G+ \' q. R0 u# b. M  v1 A/ `5 r3 E

. v( T! D8 z2 B" ^+ B' \
/ z. K& J  a' s1 s7 O+ T
' c# A7 `1 o) X( E7 w, ^3 }& F) U7 j4 b& H. v
( M  j" @# B( {/ ~4 O& ?% S) ]9 H
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:27 , Processed in 0.047241 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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