suppert X86 and arm64

master
czd 2 years ago
parent a02f665d0e
commit 6faa76280a

@ -0,0 +1 @@
sealos.hub:5000/kuboard/kuboard:v3

@ -0,0 +1,200 @@
#!/bin/bash
checkVersion() {
# 检查kube-apiserver进程是否在运行
if pgrep kube-apiserver > /dev/null
then
echo "本机是Kubernetes集群的master节点。"
else
echo "本机不是Kubernetes集群的master节点。"
stty erase '^?'
exit 1
fi
#检查是否安装了nerdctl工具
command -v nerdctl
if [ $? != 0 ];then
echo "请先安装nerdctl工具"
stty erase '^?'
exit 1
fi
}
importImages() {
mkdir -p /root/.docker
cat <<EOF > /root/.docker/config.json
{
"auths": {
"sealos.hub:5000": {
"auth": "YWRtaW46cGFzc3cwcmQ="
}
}
}
EOF
for i in *.tar
do
nerdctl -n k8s.io load < $i
done
while read line
do
nerdctl -n k8s.io push $line
done < images.list
}
checkVersion
importImages
ipaddr=$(ip addr | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}' | awk 'NR==1{print}')
echo "current ip address is ${ipaddr}"
echo "create file /root/kuboard-sa.yaml"
echo
cat > /root/kuboard-sa.yaml << EOF
---
kind: Namespace
apiVersion: v1
metadata:
name: kuboard
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: kuboard-admin
namespace: kuboard
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kuboard-admin-crb
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kuboard-admin
namespace: kuboard
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: kuboard-viewer
namespace: kuboard
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: kuboard-viewer-crb
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
name: kuboard-viewer
namespace: kuboard
EOF
echo "kubectl apply -f /root/kuboard-sa.yaml"
kubectl apply -f /root/kuboard-sa.yaml
echo
echo "create file /etc/kubernetes/manifests/kuboard.yaml"
echo
cat > /etc/kubernetes/manifests/kuboard.yaml << EOF
---
apiVersion: v1
kind: Pod
metadata:
annotations: {}
labels:
k8s.kuboard.cn/name: kuboard-v3
name: kuboard-v3
namespace: kuboard
spec:
containers:
- env:
- name: KUBOARD_ENDPOINT
value: "http://${ipaddr}:12345"
- name: KUBOARD_AGENT_SERVER_TCP_PORT
value: "10081"
image: 'sealos.hub:5000/kuboard/kuboard:v3'
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 3
httpGet:
path: /kuboard-resources/version.json
port: 80
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
name: kuboard
ports:
- containerPort: 80
hostPort: 12345
name: web
protocol: TCP
- containerPort: 10081
name: peer
protocol: TCP
hostPort: 10081
- containerPort: 10081
name: peer-u
protocol: UDP
hostPort: 10081
readinessProbe:
failureThreshold: 3
httpGet:
path: /kuboard-resources/version.json
port: 80
scheme: HTTP
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
volumeMounts:
- mountPath: /data
name: data
- mountPath: /init-etcd-scripts/import-cluster-once.yaml
name: import-cluster-yaml
volumes:
- hostPath:
path: "/usr/share/kuboard"
name: data
- hostPath:
path: "/usr/share/kuboard/import-cluster-once.yaml"
name: import-cluster-yaml
dnsPolicy: ClusterFirst
restartPolicy: Always
tolerations:
- key: node-role.kubernetes.io/master
operator: Exists
EOF
echo "restart kubelet"
systemctl restart kubelet
host_name=$(hostname)
echo
echo "\033[34m检查状态\033[0m 待 kuboard-v3-${host_name} 的容器组变为 Running 状态后,则安装成功,可以通过 http://${ipaddr} 访问 kuboard 界面"
echo
kubectl get pods -n kuboard -o wide

Binary file not shown.
Loading…
Cancel
Save