- 积分
- 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
% m6 m# F' N0 ]% Y/ s7 q[init] Using Kubernetes version: v1.28.0
1 y# x2 W% P6 K8 d1 @# Z2 r[preflight] Running pre-flight checks. i; _# c7 u, H3 R( `
[preflight] Pulling images required for setting up a Kubernetes cluster- }" G' f; _" d! l
[preflight] This might take a minute or two, depending on the speed of your internet connection; o D$ H. ] e: d. L
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
4 o. [8 b$ @5 S' W6 c[certs] Using certificateDir folder "/etc/kubernetes/pki"5 |0 {8 r' h2 l' W7 }- B p
[certs] Generating "ca" certificate and key, [6 z& ?( Z5 K& v9 z
[certs] Generating "apiserver" certificate and key5 u5 c# n* [* o O9 n& q9 e
[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]
$ z/ Q3 `- V* m8 ^. s' H2 T! H[certs] Generating "apiserver-kubelet-client" certificate and key% h! M7 K* M! ]1 B8 b6 h" A2 S
[certs] Generating "front-proxy-ca" certificate and key
% y% r! t6 l6 t& ?7 `# B* }- O[certs] Generating "front-proxy-client" certificate and key
4 {2 l2 M- ~/ Q5 F; {9 j0 L[certs] Generating "etcd/ca" certificate and key* ~* R& R/ i k( n+ X
[certs] Generating "etcd/server" certificate and key
* |9 l( |" E: i5 k7 Y( J; V[certs] etcd/server serving cert is signed for DNS names [kubernetes-master localhost] and IPs [192.168.8.190 127.0.0.1 ::1]
1 U+ R6 `* F/ T+ |) b. N[certs] Generating "etcd/peer" certificate and key2 k! ?) A7 j8 l" [1 Y7 G5 n7 f
[certs] etcd/peer serving cert is signed for DNS names [kubernetes-master localhost] and IPs [192.168.8.190 127.0.0.1 ::1]# j$ I q- i# ~( v4 B, x* `8 \
[certs] Generating "etcd/healthcheck-client" certificate and key6 U% r8 _" {; p% R! O
[certs] Generating "apiserver-etcd-client" certificate and key' N+ |7 @; P4 @# Y! Z& J
[certs] Generating "sa" key and public key
9 h0 V2 h( k- J. H. |( ^: y& u[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
. w5 ^& Z) |, {7 Y- Z/ B, E' m[kubeconfig] Writing "admin.conf" kubeconfig file
( H) v# a. l" n9 ] d# D[kubeconfig] Writing "kubelet.conf" kubeconfig file
% S; [9 [3 B* r4 ~( K[kubeconfig] Writing "controller-manager.conf" kubeconfig file: x, F/ E* q Y9 g
[kubeconfig] Writing "scheduler.conf" kubeconfig file* u `3 [( F9 z( G; v
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
$ b$ l, g4 z9 Z W" ~ E[control-plane] Using manifest folder "/etc/kubernetes/manifests"
4 u9 v5 X2 r8 _/ e[control-plane] Creating static Pod manifest for "kube-apiserver"
- m3 N3 t2 [# F[control-plane] Creating static Pod manifest for "kube-controller-manager"& ~. K" k, S( ~2 b( c/ P; Q2 J6 |- }
[control-plane] Creating static Pod manifest for "kube-scheduler"
( P; g! t5 {1 n7 G[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
9 v8 u- h) g8 X2 A, `[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
/ P( u! V: E9 Y! e, q, l9 T* R[kubelet-start] Starting the kubelet
' N) r& E( k' w4 m[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
# U9 T3 h) d8 J+ u6 U, q[apiclient] All control plane components are healthy after 17.005335 seconds
5 }4 t* I* T m) x3 j7 L* U[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace' B. x8 L" o9 ^0 W- x) `* E
[kubelet] Creating a ConfigMap "kubelet-config" in namespace kube-system with the configuration for the kubelets in the cluster
, R" N, h1 X* Q! M+ ^2 Q. }6 ~[upload-certs] Skipping phase. Please see --upload-certs
: L( f# Z' `, E4 n4 z9 b4 k[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]2 T% i9 g9 B" I0 S
[mark-control-plane] Marking the node kubernetes-master as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule]
: x+ U3 e1 T' J5 G[bootstrap-token] Using token: ajiqtj.xwpscuol7csse0d9
! e; x/ p8 h7 u1 |2 D) Z[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles" b+ l$ {/ R) O8 l7 u
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes0 P/ [" |; H; C0 u% Z9 W7 q! j: [: o
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials' }' ?* k7 d- O {3 ]
[bootstrap-token] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token4 \$ K5 j4 G% q x$ \$ \! R/ q
[bootstrap-token] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster! {; q/ J# u" {) t7 G# T H
[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
3 y. q( ~8 J2 M[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
, G( S( t. `6 A! J6 D! l; P4 Q[addons] Applied essential addon: CoreDNS
" L7 U1 y% ~/ o% N) {( R- A" _( t0 R[addons] Applied essential addon: kube-proxy
' u/ r" B) d, h. C; u6 d5 C3 [, s/ g3 E1 d' U. l9 S
Your Kubernetes control-plane has initialized successfully!
% v$ w0 u2 Q, n! f& F- J5 `- y, P4 C" m `- @7 q3 q9 L( v
To start using your cluster, you need to run the following as a regular user:
8 \( `8 k% o5 _6 {3 }! Q$ C0 H/ D* _9 Z% X2 }
mkdir -p $HOME/.kube3 L( O8 W! t* ^ ~3 A
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config" `* I- D/ R* P: g
sudo chown $(id -u):$(id -g) $HOME/.kube/config, e7 w; g+ ]4 n, y h3 ?8 ^9 X! T
( v+ U# S3 F1 c0 `
Alternatively, if you are the root user, you can run:! w" j+ p- E* u& V0 r- I- N
( T: e4 L' h" L* a: {
export KUBECONFIG=/etc/kubernetes/admin.conf2 h- c; t+ ?1 U: ]! g5 G
Z( s$ k, x4 L" ^1 ~3 J2 i; v/ n
You should now deploy a pod network to the cluster.$ F: v" N! l/ o# G1 D) j
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
5 o3 k; F$ A7 L V https://kubernetes.io/docs/conce ... inistration/addons/
2 y$ ~6 O" y e8 s& e
1 C. O7 }1 l, }- N6 U5 sThen you can join any number of worker nodes by running the following on each as root:
* ^( R! \# s7 d
2 l0 Y' U7 ^6 h0 U% o6 T4 Ikubeadm join 192.168.8.190:6443 --token ajiqtj.xwpscuol7csse0d9 \
' P: [( D/ l+ D --discovery-token-ca-cert-hash sha256:87ab51d4f77f290e00c0060990eb5efa886752e39b2e74721d96d2c41bb92699 * [0 Q7 m0 V# G+ t; B% p* Q9 t- u
[root@kubernetes-master net]# ! V( u% W$ a* b& w6 \' I
|
|