KubeSphere 更新到 4.x 了

此文章记录下新版KubeSphere使用,主要讲下遇到的问题

1 安装 KubeSphere

Tip

我这里已经有 k8s 集群了,直接在现有集群上,安装 k8s 参考安装 Kubernetes 与 KubeSphere)

1.1 修改配置

官网默认不是高可用,而且没持久化

redisHA需要有默认StorageClass

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
helm pull https://charts.kubesphere.io/main/ks-core-1.1.2.tgz
tar -zxvf ks-core-1.1.2.tgz
cd ks-core/
vim values.yaml
global:
imageRegistry: swr.cn-southwest-2.myhuaweicloud.com/ks
tag: v4.1.2
portal:
hostname: "kubesphere.ccops.com"
ingress:
enabled: true
ingressClassName: "traefik-class"
tls:
enabled: false
hostClusterName: "ccops"
ha:
enabled: true
redis:
enabled: false
redisHA:
enabled: true
helm upgrade --install -n kubesphere-system --create-namespace ks-core . --debug --wait

1.2 查看状态

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
kubectl get pod -n kubesphere-system 
NAME READY STATUS RESTARTS AGE
extensions-museum-97b8fd969-z8bsc 1/1 Running 0 18m
ks-apiserver-6898f48b94-886w5 1/1 Running 1 (16m ago) 18m
ks-apiserver-6898f48b94-d7bwg 1/1 Running 1 (17m ago) 18m
ks-apiserver-6898f48b94-lpc5d 1/1 Running 1 (16m ago) 18m
ks-console-6d547457d-9chk8 1/1 Running 0 18m
ks-console-6d547457d-nx85j 1/1 Running 0 18m
ks-console-6d547457d-thtld 1/1 Running 0 18m
ks-controller-manager-78dbb648bb-6qm5v 1/1 Running 0 18m
ks-controller-manager-78dbb648bb-k9cz6 1/1 Running 0 18m
ks-controller-manager-78dbb648bb-sf897 1/1 Running 0 18m
ks-core-redisha-haproxy-bf8d4f8dc-cn6kc 1/1 Running 0 18m
ks-core-redisha-haproxy-bf8d4f8dc-ggctv 1/1 Running 0 18m
ks-core-redisha-haproxy-bf8d4f8dc-mc792 1/1 Running 0 18m
ks-core-redisha-server-0 3/3 Running 0 16m
ks-core-redisha-server-1 3/3 Running 0 10m
ks-core-redisha-server-2 3/3 Running 0 6m
默认账号密码:admin/P@88w0rd

image.png

2 DevOps

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
global:
imageRegistry: swr.cn-southwest-2.myhuaweicloud.com/ks
extension:
apiserver:
replicas: 2
resources:
limits:
cpu: 500m
memory: 1024Mi
requests:
memory: 128Mi
cpu: 100m

agent:
apiserver:
replicas: 2
resources:
limits:
cpu: 500m
memory: 1024Mi
requests:
memory: 128Mi
cpu: 100m
controller:
replicas: 2
resources:
limits:
cpu: 500m
memory: 1024Mi
requests:
cpu: 100m
memory: 128Mi
jenkins:
securityRealm:
openIdConnect:
# The kubesphere-core api used for jenkins OIDC
# If you want to access to jenkinsWebUI, the kubesphereCoreApi must be specified and browser-accessible
# Modifying this configuration will take effect only during installation
# If you wish for changes to take effect after installation, you need to update the jenkins-casc-config ConfigMap, copy the securityRealm configuration from jenkins.yaml to jenkins_user.yaml, save, and wait for approximately 70 seconds for the changes to take effect.
kubesphereCoreApi: "http://ks-apiserver:30880"
# The jenkins web URL used for OIDC redirect
jenkinsURL: "http://devops-jenkins:30180"
Master:
resources:
requests:
cpu: 0.5
memory: 6Gi
limits:
cpu: 2
memory: 6Gi # recommend set same as requests.memory
# smtp server settings for notification
smtp:
EMAIL_SMTP_HOST: "mail.example.com"
EMAIL_SMTP_PORT: "465"
EMAIL_USE_SSL: false
EMAIL_FROM_NAME: "KubeSphere"
EMAIL_FROM_ADDR: "admin@example.com"
EMAIL_FROM_PASS: "P@ssw0rd"
# sonarQube settings
sonarqube:
serverUrl: ""
authToken: ""
persistence:
size: 16Gi
storageClass: "nfs-sc"
accessMode: ReadWriteOnce
kubeconfigEnabled: true