下载 kk rpm 安装包
    https://github.com/kubesphere/kubekey/releases/tag/v1.2.0-alpha.5

    1633057192(1).png

    1. [root@master ~]# rpm -ivh kubekey-v2.1.1-linux-64bit.rpm
    2. Preparing... ################################# [100%]
    3. Updating / installing...
    4. 1:kubekey-0:2.1.1-1 ################################# [100%]
    5. [root@master ~]# kk version
    6. version.BuildInfo{Version:"2.1.1", GitCommit:"b19724c7", GitTreeState:"", GoVersion:"go1.17.10"}
    7. [root@master ~]#

    声明环境变量

    1. export KKZONE=cn
    1. [root@riyimei home]# kk upgrade --with-kubesphere v3.2.0-alpha.0
    2. +---------+------+------+---------+----------+-------+-------+-----------+---------+------------+-------------+------------------+--------------+
    3. | name | sudo | curl | openssl | ebtables | socat | ipset | conntrack | docker | nfs client | ceph client | glusterfs client | time |
    4. +---------+------+------+---------+----------+-------+-------+-----------+---------+------------+-------------+------------------+--------------+
    5. | riyimei | y | y | y | y | | y | y | 19.03.7 | | | | CST 10:53:32 |
    6. +---------+------+------+---------+----------+-------+-------+-----------+---------+------------+-------------+------------------+--------------+
    7. Warning:
    8. An old Docker version may cause the failure of upgrade. It is recommended that you upgrade Docker to 20.10+ beforehand.
    9. Issue: https://github.com/kubernetes/kubernetes/issues/101056
    10. Cluster nodes status:
    11. NAME STATUS ROLES AGE VERSION
    12. riyimei Ready control-plane,master,worker 102d v1.20.4
    13. Upgrade Confirmation:
    14. kubernetes version: v1.20.4 to v1.21.5
    15. kubesphere version: v3.1.0 to v3.2.0-alpha.0
    16. Continue upgrading cluster? [yes/no]: yes
    17. INFO[10:53:35 CST] Get current version
    18. INFO[10:53:35 CST] Configuring operating system ...
    19. [riyimei 192.168.11.190] MSG:
    20. net.ipv4.ip_forward = 1
    21. net.bridge.bridge-nf-call-arptables = 1
    22. net.bridge.bridge-nf-call-ip6tables = 1
    23. net.bridge.bridge-nf-call-iptables = 1
    24. net.ipv4.ip_local_reserved_ports = 30000-32767
    25. vm.max_map_count = 262144
    26. vm.swappiness = 1
    27. fs.inotify.max_user_instances = 524288
    28. INFO[10:53:40 CST] Upgrading kube cluster
    29. INFO[10:53:40 CST] Start Upgrade: v1.20.4 -> v1.21.5
    30. INFO[10:53:40 CST] Downloading Installation Files
    31. INFO[10:53:40 CST] Downloading kubeadm ...
    32. INFO[10:53:40 CST] Downloading kubelet ...
    33. INFO[10:53:41 CST] Downloading kubectl ...
    34. INFO[10:53:41 CST] Downloading helm ...
    35. INFO[10:53:42 CST] Downloading kubecni ...
    36. INFO[10:54:22 CST] Downloading etcd ...
    37. INFO[10:54:40 CST] Downloading docker ...
    38. INFO[10:55:43 CST] Downloading crictl ...
    39. [riyimei] Downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/pause:3.4.1
    40. [riyimei] Downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-apiserver:v1.21.5
    41. [riyimei] Downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controller-manager:v1.21.5
    42. [riyimei] Downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-scheduler:v1.21.5
    43. [riyimei] Downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-proxy:v1.21.5
    44. [riyimei] Downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/coredns:1.8.0
    45. [riyimei] Downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/k8s-dns-node-cache:1.15.12
    46. [riyimei] Downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controllers:v3.20.0
    47. [riyimei] Downloading image: registry.cn-beijing.aliyuncs.com/kubesphereio/cni:v3.20.0
    1. # 将 completion 脚本添加到你的 ~/.bashrc 文件
    2. echo 'source <(kubectl completion bash)' >>~/.bashrc
    3. # 将 completion 脚本添加到 /etc/bash_completion.d 目录
    4. kubectl completion bash >/etc/bash_completion.d/kubectl

    k3s

    1. [root@riyimei ~]# ./kk create cluster --with-kubernetes v1.21.6-k3s --with-kubesphere v3.3.0-alpha.1
    2. _ __ _ _ __
    3. | | / / | | | | / /
    4. | |/ / _ _| |__ ___| |/ / ___ _ _
    5. | \| | | | '_ \ / _ \ \ / _ \ | | |
    6. | |\ \ |_| | |_) | __/ |\ \ __/ |_| |
    7. \_| \_/\__,_|_.__/ \___\_| \_/\___|\__, |
    8. __/ |
    9. |___/
    10. 11:52:23 CST [GreetingsModule] Greetings
    11. 11:52:23 CST message: [riyimei]
    12. Greetings, KubeKey!
    13. 11:52:23 CST success: [riyimei]
    14. 11:52:23 CST [K3sNodeBinariesModule] Download installation binaries
    15. 11:52:23 CST message: [localhost]
    16. downloading amd64 k3s v1.21.6 ...
    17. % Total % Received % Xferd Average Speed Time Time Time Current
    18. Dload Upload Total Spent Left Speed
    19. 100 46.8M 100 46.8M 0 0 1012k 0 0:00:47 0:00:47 --:--:-- 1052k
    20. 11:53:11 CST message: [localhost]
    21. downloading amd64 helm v3.6.3 ...
    22. % Total % Received % Xferd Average Speed Time Time Time Current
    23. Dload Upload Total Spent Left Speed
    24. 100 43.0M 100 43.0M 0 0 1006k 0 0:00:43 0:00:43 --:--:-- 1042k
    25. 11:53:55 CST message: [localhost]
    26. downloading amd64 kubecni v0.9.1 ...
    27. % Total % Received % Xferd Average Speed Time Time Time Current
    28. Dload Upload Total Spent Left Speed
    29. 100 37.9M 100 37.9M 0 0 956k 0 0:00:40 0:00:40 --:--:-- 1055k
    30. 11:54:36 CST message: [localhost]
    31. downloading amd64 etcd v3.4.13 ...
    32. % Total % Received % Xferd Average Speed Time Time Time Current
    33. Dload Upload Total Spent Left Speed
    34. 100 16.5M 100 16.5M 0 0 1011k 0 0:00:16 0:00:16 --:--:-- 1058k
    35. 11:54:53 CST success: [LocalHost]
    36. 11:54:53 CST [ConfigureOSModule] Prepare to init OS
    37. 11:54:54 CST success: [riyimei]
    38. 11:54:54 CST [ConfigureOSModule] Generate init os script
    39. 11:54:54 CST success: [riyimei]
    40. 11:54:54 CST [ConfigureOSModule] Exec init os script
    41. 11:54:55 CST stdout: [riyimei]
    42. setenforce: SELinux is disabled
    43. Disabled
    44. net.ipv4.ip_forward = 1
    45. net.bridge.bridge-nf-call-arptables = 1
    46. net.bridge.bridge-nf-call-ip6tables = 1
    47. net.bridge.bridge-nf-call-iptables = 1
    48. net.ipv4.ip_local_reserved_ports = 30000-32767
    49. vm.max_map_count = 262144
    50. vm.swappiness = 1
    51. fs.inotify.max_user_instances = 524288
    52. kernel.pid_max = 65535
    53. 11:54:55 CST success: [riyimei]
    54. 11:54:55 CST [ConfigureOSModule] configure the ntp server for each node
    55. 11:54:55 CST skipped: [riyimei]
    56. 11:54:55 CST [StatusModule] Get k3s cluster status
    57. 11:54:55 CST success: [riyimei]
    58. 11:54:55 CST [ETCDPreCheckModule] Get etcd status
    59. 11:54:55 CST success: [riyimei]
    60. 11:54:55 CST [CertsModule] Fetch etcd certs
    61. 11:54:55 CST success: [riyimei]
    62. 11:54:55 CST [CertsModule] Generate etcd Certs
    63. [certs] Generating "ca" certificate and key
    64. [certs] admin-riyimei serving cert is signed for DNS names [etcd etcd.kube-system etcd.kube-system.svc etcd.kube-system.svc.cluster.local lb.kubesphere.local localhost riyimei] and IPs [127.0.0.1 ::1 192.168.11.190]
    65. [certs] member-riyimei serving cert is signed for DNS names [etcd etcd.kube-system etcd.kube-system.svc etcd.kube-system.svc.cluster.local lb.kubesphere.local localhost riyimei] and IPs [127.0.0.1 ::1 192.168.11.190]
    66. [certs] node-riyimei serving cert is signed for DNS names [etcd etcd.kube-system etcd.kube-system.svc etcd.kube-system.svc.cluster.local lb.kubesphere.local localhost riyimei] and IPs [127.0.0.1 ::1 192.168.11.190]
    67. 11:54:56 CST success: [LocalHost]
    68. 11:54:56 CST [CertsModule] Synchronize certs file
    69. 11:54:57 CST success: [riyimei]
    70. 11:54:57 CST [CertsModule] Synchronize certs file to master
    71. 11:54:57 CST skipped: [riyimei]
    72. 11:54:57 CST [InstallETCDBinaryModule] Install etcd using binary
    73. 11:54:58 CST success: [riyimei]
    74. 11:54:58 CST [InstallETCDBinaryModule] Generate etcd service
    75. 11:54:58 CST success: [riyimei]
    76. 11:54:58 CST [InstallETCDBinaryModule] Generate access address
    77. 11:54:58 CST success: [riyimei]
    78. 11:54:58 CST [ETCDConfigureModule] Health check on exist etcd
    79. 11:54:59 CST skipped: [riyimei]
    80. 11:54:59 CST [ETCDConfigureModule] Generate etcd.env config on new etcd
    81. 11:54:59 CST success: [riyimei]
    82. 11:54:59 CST [ETCDConfigureModule] Refresh etcd.env config on all etcd
    83. 11:54:59 CST success: [riyimei]
    84. 11:54:59 CST [ETCDConfigureModule] Restart etcd
    85. 11:55:04 CST stdout: [riyimei]
    86. Created symlink from /etc/systemd/system/multi-user.target.wants/etcd.service to /etc/systemd/system/etcd.service.
    87. 11:55:04 CST success: [riyimei]
    88. 11:55:04 CST [ETCDConfigureModule] Health check on all etcd
    89. 11:55:04 CST success: [riyimei]
    90. 11:55:04 CST [ETCDConfigureModule] Refresh etcd.env config to exist mode on all etcd
    91. 11:55:04 CST success: [riyimei]
    92. 11:55:04 CST [ETCDConfigureModule] Health check on all etcd
    93. 11:55:04 CST success: [riyimei]
    94. 11:55:04 CST [ETCDBackupModule] Backup etcd data regularly
    95. 11:55:11 CST success: [riyimei]
    96. 11:55:11 CST [InstallKubeBinariesModule] Synchronize k3s binaries
    97. 11:55:14 CST success: [riyimei]
    98. 11:55:14 CST [InstallKubeBinariesModule] Generate k3s killall.sh script
    99. 11:55:15 CST success: [riyimei]
    100. 11:55:15 CST [InstallKubeBinariesModule] Generate k3s uninstall script
    101. 11:55:15 CST success: [riyimei]
    102. 11:55:15 CST [InstallKubeBinariesModule] Chmod +x k3s script
    103. 11:55:15 CST success: [riyimei]
    104. 11:55:15 CST [K3sInitClusterModule] Generate k3s Service
    105. 11:55:15 CST success: [riyimei]
    106. 11:55:15 CST [K3sInitClusterModule] Generate k3s service env
    107. 11:55:15 CST success: [riyimei]
    108. 11:55:15 CST [K3sInitClusterModule] Enable k3s service
    109. 11:55:29 CST success: [riyimei]
    110. 11:55:29 CST [K3sInitClusterModule] Copy k3s.yaml to ~/.kube/config
    111. 11:55:30 CST success: [riyimei]
    112. 11:55:30 CST [K3sInitClusterModule] Add master taint
    113. 11:55:30 CST skipped: [riyimei]
    114. 11:55:30 CST [K3sInitClusterModule] Add worker label
    115. 11:55:30 CST success: [riyimei]
    116. 11:55:30 CST [StatusModule] Get k3s cluster status
    117. 11:55:30 CST stdout: [riyimei]
    118. v1.21.6+k3s1
    119. 11:55:30 CST stdout: [riyimei]
    120. K10d23736c832e37ae9fbe915cc4a0c35a0156ea207ad58471a2ab39e9adb6cf049::server:6543932a784c55afa18201a11417f297
    121. 11:55:31 CST stdout: [riyimei]
    122. riyimei v1.21.6+k3s1 [map[address:192.168.11.190 type:InternalIP] map[address:riyimei type:Hostname]]
    123. 11:55:31 CST success: [riyimei]
    124. 11:55:31 CST [K3sJoinNodesModule] Generate k3s Service
    125. 11:55:31 CST skipped: [riyimei]
    126. 11:55:31 CST [K3sJoinNodesModule] Generate k3s service env
    127. 11:55:31 CST skipped: [riyimei]
    128. 11:55:31 CST [K3sJoinNodesModule] Enable k3s service
    129. 11:55:31 CST skipped: [riyimei]
    130. 11:55:31 CST [K3sJoinNodesModule] Copy k3s.yaml to ~/.kube/config
    131. 11:55:31 CST skipped: [riyimei]
    132. 11:55:31 CST [K3sJoinNodesModule] Synchronize kube config to worker
    133. 11:55:31 CST skipped: [riyimei]
    134. 11:55:31 CST [K3sJoinNodesModule] Add master taint
    135. 11:55:31 CST skipped: [riyimei]
    136. 11:55:31 CST [K3sJoinNodesModule] Add worker label
    137. 11:55:31 CST skipped: [riyimei]
    138. 11:55:31 CST [DeployNetworkPluginModule] Generate calico
    139. 11:55:31 CST success: [riyimei]
    140. 11:55:31 CST [DeployNetworkPluginModule] Deploy calico
    141. 11:55:33 CST stdout: [riyimei]
    142. configmap/calico-config created
    143. customresourcedefinition.apiextensions.k8s.io/bgpconfigurations.crd.projectcalico.org created
    144. customresourcedefinition.apiextensions.k8s.io/bgppeers.crd.projectcalico.org created
    145. customresourcedefinition.apiextensions.k8s.io/blockaffinities.crd.projectcalico.org created
    146. customresourcedefinition.apiextensions.k8s.io/clusterinformations.crd.projectcalico.org created
    147. customresourcedefinition.apiextensions.k8s.io/felixconfigurations.crd.projectcalico.org created
    148. customresourcedefinition.apiextensions.k8s.io/globalnetworkpolicies.crd.projectcalico.org created
    149. customresourcedefinition.apiextensions.k8s.io/globalnetworksets.crd.projectcalico.org created
    150. customresourcedefinition.apiextensions.k8s.io/hostendpoints.crd.projectcalico.org created
    151. customresourcedefinition.apiextensions.k8s.io/ipamblocks.crd.projectcalico.org created
    152. customresourcedefinition.apiextensions.k8s.io/ipamconfigs.crd.projectcalico.org created
    153. customresourcedefinition.apiextensions.k8s.io/ipamhandles.crd.projectcalico.org created
    154. customresourcedefinition.apiextensions.k8s.io/ippools.crd.projectcalico.org created
    155. customresourcedefinition.apiextensions.k8s.io/kubecontrollersconfigurations.crd.projectcalico.org created
    156. customresourcedefinition.apiextensions.k8s.io/networkpolicies.crd.projectcalico.org created
    157. customresourcedefinition.apiextensions.k8s.io/networksets.crd.projectcalico.org created
    158. clusterrole.rbac.authorization.k8s.io/calico-kube-controllers created
    159. clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers created
    160. clusterrole.rbac.authorization.k8s.io/calico-node created
    161. clusterrolebinding.rbac.authorization.k8s.io/calico-node created
    162. daemonset.apps/calico-node created
    163. serviceaccount/calico-node created
    164. deployment.apps/calico-kube-controllers created
    165. serviceaccount/calico-kube-controllers created
    166. Warning: policy/v1beta1 PodDisruptionBudget is deprecated in v1.21+, unavailable in v1.25+; use policy/v1 PodDisruptionBudget
    167. poddisruptionbudget.policy/calico-kube-controllers created
    168. 11:55:33 CST success: [riyimei]
    169. 11:55:33 CST [ConfigureKubernetesModule] Configure kubernetes
    170. 11:55:33 CST success: [riyimei]
    171. 11:55:33 CST [ChownModule] Chown user $HOME/.kube dir
    172. 11:55:33 CST success: [riyimei]
    173. 11:55:33 CST [SaveKubeConfigModule] Save kube config as a configmap
    174. 11:55:33 CST success: [LocalHost]
    175. 11:55:33 CST [AddonsModule] Install addons
    176. 11:55:33 CST success: [LocalHost]
    177. 11:55:33 CST [DeployStorageClassModule] Generate OpenEBS manifest
    178. 11:55:34 CST success: [riyimei]
    179. 11:55:34 CST [DeployStorageClassModule] Deploy OpenEBS as cluster default StorageClass
    180. 11:55:35 CST success: [riyimei]
    181. 11:55:35 CST [DeployKubeSphereModule] Generate KubeSphere ks-installer crd manifests
    182. 11:55:35 CST success: [riyimei]
    183. 11:55:35 CST [DeployKubeSphereModule] Apply ks-installer
    184. 11:55:36 CST stdout: [riyimei]
    185. namespace/kubesphere-system created
    186. serviceaccount/ks-installer created
    187. customresourcedefinition.apiextensions.k8s.io/clusterconfigurations.installer.kubesphere.io created
    188. clusterrole.rbac.authorization.k8s.io/ks-installer created
    189. clusterrolebinding.rbac.authorization.k8s.io/ks-installer created
    190. deployment.apps/ks-installer created
    191. 11:55:36 CST success: [riyimei]
    192. 11:55:36 CST [DeployKubeSphereModule] Add config to ks-installer manifests
    193. 11:55:36 CST success: [riyimei]
    194. 11:55:36 CST [DeployKubeSphereModule] Create the kubesphere namespace
    195. 11:55:36 CST success: [riyimei]
    196. 11:55:36 CST [DeployKubeSphereModule] Setup ks-installer config
    197. 11:55:37 CST stdout: [riyimei]
    198. secret/kube-etcd-client-certs created
    199. 11:55:37 CST success: [riyimei]
    200. 11:55:37 CST [DeployKubeSphereModule] Apply ks-installer
    201. 11:55:38 CST stdout: [riyimei]
    202. namespace/kubesphere-system unchanged
    203. serviceaccount/ks-installer unchanged
    204. customresourcedefinition.apiextensions.k8s.io/clusterconfigurations.installer.kubesphere.io unchanged
    205. clusterrole.rbac.authorization.k8s.io/ks-installer unchanged
    206. clusterrolebinding.rbac.authorization.k8s.io/ks-installer unchanged
    207. deployment.apps/ks-installer unchanged
    208. clusterconfiguration.installer.kubesphere.io/ks-installer created
    209. 11:55:38 CST success: [riyimei]
    210. #####################################################
    211. ### Welcome to KubeSphere! ###
    212. #####################################################
    213. Console: http://192.168.11.190:30880
    214. Account: admin
    215. Password: P@88w0rd
    216. NOTES:
    217. 1. After you log into the console, please check the
    218. monitoring status of service components in
    219. "Cluster Management". If any service is not
    220. ready, please wait patiently until all components
    221. are up and running.
    222. 2. Please change the default password after login.
    223. #####################################################
    224. https://kubesphere.io 2022-04-23 12:04:21
    225. #####################################################
    226. 12:04:25 CST success: [riyimei]
    227. 12:04:25 CST Pipeline[K3sCreateClusterPipeline] execute successful
    228. Installation is complete.
    229. Please check the result using the command:
    230. kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
    231. [root@riyimei ~]#
    1. [root@riyimei ~]# kubectl get pod -A
    2. NAMESPACE NAME READY STATUS RESTARTS AGE
    3. kube-system calico-kube-controllers-75ddb95444-ftxhh 1/1 Running 0 9m48s
    4. kube-system calico-node-g6pjb 1/1 Running 0 9m48s
    5. kube-system coredns-7448499f4d-c8jg7 1/1 Running 0 9m48s
    6. kube-system openebs-localpv-provisioner-6c9dcb5c54-64zjb 1/1 Running 0 9m48s
    7. kube-system snapshot-controller-0 1/1 Running 0 7m40s
    8. kubesphere-controls-system default-http-backend-5bf68ff9b8-swxb2 1/1 Running 0 6m25s
    9. kubesphere-controls-system kubectl-admin-6667774bb-kn659 1/1 Running 0 81s
    10. kubesphere-monitoring-system alertmanager-main-0 2/2 Running 0 3m13s
    11. kubesphere-monitoring-system kube-state-metrics-7bdc7484cf-wxwz6 3/3 Running 0 3m25s
    12. kubesphere-monitoring-system node-exporter-27gvk 2/2 Running 0 3m27s
    13. kubesphere-monitoring-system notification-manager-deployment-8689b68cdc-s6cw5 2/2 Running 0 117s
    14. kubesphere-monitoring-system notification-manager-operator-75fcc656f7-77ttx 2/2 Running 0 2m34s
    15. kubesphere-monitoring-system prometheus-k8s-0 2/2 Running 0 3m11s
    16. kubesphere-monitoring-system prometheus-operator-8955bbd98-fptsf 2/2 Running 0 3m28s
    17. kubesphere-system ks-apiserver-777b6db954-fdc4z 1/1 Running 0 102s
    18. kubesphere-system ks-console-5bd87ccd4d-ppj4d 1/1 Running 0 6m25s
    19. kubesphere-system ks-controller-manager-68d86b6db6-vxlb4 1/1 Running 0 101s
    20. kubesphere-system ks-installer-754fc84489-4xbvd 1/1 Running 0 9m48s
    21. [root@riyimei ~]#