- 积分
- 1193
在线时间 小时
最后登录1970-1-1
|
发表于 2024-9-15 10:54:27
|
显示全部楼层
[root@kubernetes-master net]# kubeadm init --apiserver-advertise-address=192.168.8.190 --image-repository registry.aliyuncs.com/google_containers --kubernetes-version v1.28.0 --service-cidr=10.177.100.0/12 --pod-network-cidr=10.233.0.0/16 --cri-socket=unix:///var/run/cri-dockerd.sock 8 O+ J$ \4 T5 D7 t6 b; o% c" D1 E
[init] Using Kubernetes version: v1.28.0+ U# t0 @8 Q/ y
[preflight] Running pre-flight checks* g+ b3 b; b9 z. h7 R
[preflight] Pulling images required for setting up a Kubernetes cluster$ h, M) n$ s: {: r. y, S) X
[preflight] This might take a minute or two, depending on the speed of your internet connection
. d1 |# ]. v8 p/ {[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
3 W" x* r, v& L( V5 v9 z[certs] Using certificateDir folder "/etc/kubernetes/pki"' u7 F; I) i# P. D8 v L( {$ T
[certs] Generating "ca" certificate and key: L3 U% h* {: p$ P2 l' l
[certs] Generating "apiserver" certificate and key' f! @: |/ L; C8 H! L' _! C" P
[certs] apiserver serving cert is signed for DNS names [kubernetes kubernetes-master kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.176.0.1 192.168.8.190]
9 q3 E7 g. t$ A, ~[certs] Generating "apiserver-kubelet-client" certificate and key
8 E+ o- }# t" V9 D[certs] Generating "front-proxy-ca" certificate and key/ w5 v3 x6 K% h) N
[certs] Generating "front-proxy-client" certificate and key m E3 f) R3 w# f5 A% k1 q. S
[certs] Generating "etcd/ca" certificate and key
0 u5 ? ^ e/ Z% L[certs] Generating "etcd/server" certificate and key& {0 G7 O6 G8 Q; Q7 }. }5 a
[certs] etcd/server serving cert is signed for DNS names [kubernetes-master localhost] and IPs [192.168.8.190 127.0.0.1 ::1]0 S) W e3 |- z9 J. b
[certs] Generating "etcd/peer" certificate and key/ \0 Y! ` L" G ^1 E7 X( I# d. N2 z
[certs] etcd/peer serving cert is signed for DNS names [kubernetes-master localhost] and IPs [192.168.8.190 127.0.0.1 ::1]
. g. N# Y% K. v; W. t[certs] Generating "etcd/healthcheck-client" certificate and key% e) H5 {( \$ a& y B% {. `) G
[certs] Generating "apiserver-etcd-client" certificate and key- v2 ?0 b/ C( Q$ g* Z/ O7 s
[certs] Generating "sa" key and public key
& s- g" N, q/ d: r0 _[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
# ]6 h: E/ Y0 }" ?! F( P+ v, P[kubeconfig] Writing "admin.conf" kubeconfig file
7 w" i0 H9 p% W# i[kubeconfig] Writing "kubelet.conf" kubeconfig file* t* e; Z% M' W# W5 E$ c
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
) Y4 q* ~$ j3 S* F, a' Z[kubeconfig] Writing "scheduler.conf" kubeconfig file8 ^ K; R+ `; E' H% Z
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests") U: A% c8 @! J4 T4 [
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
" ^- g" V; c# D[control-plane] Creating static Pod manifest for "kube-apiserver"4 z3 o0 s4 o* a1 T# e6 Q
[control-plane] Creating static Pod manifest for "kube-controller-manager"
& e" Q! z+ S4 {7 V[control-plane] Creating static Pod manifest for "kube-scheduler"- |5 t4 P5 K! s1 y4 G, k& S
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"( Q% J& {/ W- K I3 r
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"! `8 }7 ?) a0 }* j0 h
[kubelet-start] Starting the kubelet6 ? @! Y( _1 V/ A( B
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
8 t5 `, F$ Y1 K; w& x; q" {2 Y[apiclient] All control plane components are healthy after 17.005335 seconds
* s8 y. ~( s: e! n/ t* R* x; a! o[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace7 k: X& ?5 A" v
[kubelet] Creating a ConfigMap "kubelet-config" in namespace kube-system with the configuration for the kubelets in the cluster9 X7 t8 s' Y, p# z ?" ^
[upload-certs] Skipping phase. Please see --upload-certs9 }* g: D5 [' N) ]# e% N; V
[mark-control-plane] Marking the node kubernetes-master as control-plane by adding the labels: [node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]) |8 p4 m n3 j! M$ Y
[mark-control-plane] Marking the node kubernetes-master as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule]: O% ~! E9 Y0 Y5 h" x2 W
[bootstrap-token] Using token: ajiqtj.xwpscuol7csse0d90 [1 D- J! J- W6 I
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
% j0 B- D% f2 A- @' f* i, h[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes
4 b+ a/ p" L: l7 o( O4 ?; p- h% V[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials3 T5 k0 k% c6 m1 E3 @
[bootstrap-token] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token. V) z+ Z2 d, j" H8 M9 d
[bootstrap-token] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
9 z& ]2 z) V' U) q" m. [) A[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace( X8 Z" F2 Y9 ?+ k' N
[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
9 \5 I) d* Z" v4 a2 C5 h[addons] Applied essential addon: CoreDNS1 `: ^6 M' I8 D5 n5 w
[addons] Applied essential addon: kube-proxy
1 P1 M. ?7 u4 m7 X# n% M
! U$ J$ Y$ I0 p+ @* f+ rYour Kubernetes control-plane has initialized successfully!
) h* s' j" v) [" `
( _2 H+ B8 ?4 ~! ITo start using your cluster, you need to run the following as a regular user:
* m4 G7 m! L' {% g9 x) b
1 `( q7 X/ P; ?1 v; F mkdir -p $HOME/.kube
5 e3 R# C3 T6 m1 i2 B: L sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
' o& ~+ M: N* U+ U, x6 g, S sudo chown $(id -u):$(id -g) $HOME/.kube/config
9 W) l$ D. Q3 V. Z. L% F% ^
0 P E2 L' j, G; v& \+ F# KAlternatively, if you are the root user, you can run:
( h( o k' y8 o/ G5 ?9 h u4 R
5 r5 D- \5 A1 A! f S( ~% P export KUBECONFIG=/etc/kubernetes/admin.conf
+ u- O& l6 X. e5 B" w7 |( {2 f
s! B! H7 [2 z' pYou should now deploy a pod network to the cluster.% ?* B" \: B, l& | i5 ^
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
3 \/ P9 T' l2 S: q9 V https://kubernetes.io/docs/conce ... inistration/addons/
# L* m$ L" E( ^2 }, ?& X5 o7 Z8 {$ w# w3 j% ?" u0 o; B) G
Then you can join any number of worker nodes by running the following on each as root:2 ~, m2 e) i# S1 q9 d4 F3 V9 A4 [
2 S1 U4 m, D' r( `' ~
kubeadm join 192.168.8.190:6443 --token ajiqtj.xwpscuol7csse0d9 \
# ^% o- ?) G/ z --discovery-token-ca-cert-hash sha256:87ab51d4f77f290e00c0060990eb5efa886752e39b2e74721d96d2c41bb92699 ' u1 _8 A2 [; m
[root@kubernetes-master net]# 7 w' O* R9 A/ i" z/ ]4 x
|
|