跳到主要内容
版本:0.6.8

在 Minikube 中安装 Starwhale

先决条件

启动 Minikube

minikube start --kubernetes-version=1.25.3 --image-repository=docker-registry.starwhale.cn/minikube --base-image=docker-registry.starwhale.cn/minikube/k8s-minikube/kicbase:v0.0.42

minikube addons enable ingress --images="KubeWebhookCertgenPatch=ingress-nginx/kube-webhook-certgen:v20231011-8b53cabe0,KubeWebhookCertgenCreate=ingress-nginx/kube-webhook-certgen:v20231011-8b53cabe0,IngressController=ingress-nginx/controller:v1.9.4"

目前 docker-registry.starwhale.cn/minikube 目前只缓存了 Kubernetes 1.25.3 的镜像,也可以使用阿里云提供的 Minikube 镜像:

minikube start --image-mirror-country=cn

minikube addons enable ingress --images="KubeWebhookCertgenPatch=kube-webhook-certgen:v20231011-8b53cabe0,KubeWebhookCertgenCreate=kube-webhook-certgen:v20231011-8b53cabe0,IngressController=nginx-ingress-controller:v1.9.4" --registries="KubeWebhookCertgenPatch=registry.cn-hangzhou.aliyuncs.com/google_containers,KubeWebhookCertgenCreate=registry.cn-hangzhou.aliyuncs.com/google_containers,IngressController=registry.cn-hangzhou.aliyuncs.com/google_containers"

对于非中国大陆网络用户,可以使用如下命令:

minikube start --addons ingress

如果在您的机器上没有安装 kubectl,可以使用 Minikube 自带的 kubectl: minikube kubectl 或 bashrc中增加 alias kubectl="minikube kubectl --"

安装 Starwhale Server

helm repo add starwhale https://star-whale.github.io/charts
helm repo update
helm pull starwhale/starwhale --untar --untardir ./charts

helm upgrade --install starwhale ./charts/starwhale -n starwhale --create-namespace -f ./charts/starwhale/values.minikube.cn.yaml

对于非中国大陆网络用户,可以使用 values.minikube.global.yaml,命令如下:

helm upgrade --install starwhale ./charts/starwhale -n starwhale --create-namespace -f ./charts/starwhale/values.minikube.global.yaml

当成功安装后,会有类似如下的提示信息输出:

    Release "starwhale" has been upgraded. Happy Helming!
NAME: starwhale
LAST DEPLOYED: Tue Feb 14 16:25:03 2023
NAMESPACE: starwhale
STATUS: deployed
REVISION: 14
NOTES:
******************************************
Chart Name: starwhale
Chart Version: 0.5.6
App Version: latest
Starwhale Image:
- server: ghcr.io/star-whale/server:latest

******************************************
Controller:
- visit: http://controller.starwhale.svc
Minio:
- web visit: http://minio.starwhale.svc
- admin visit: http://minio-admin.starwhale.svc
MySQL:
- port-forward:
- run: kubectl port-forward --namespace starwhale svc/mysql 3306:3306
- visit: mysql -h 127.0.0.1 -P 3306 -ustarwhale -pstarwhale
Please run the following command for the domains searching:
echo "$(sudo minikube ip) controller.starwhale.svc minio.starwhale.svc minio-admin.starwhale.svc " | sudo tee -a /etc/hosts
******************************************
Login Info:
- starwhale: u:starwhale, p:abcd1234
- minio admin: u:minioadmin, p:minioadmin

*_* Enjoy to use Starwhale Platform. *_*

检查 Starwhale Server 状态

Minikube 方式启动 Starwhale Server 一般要用时3-5分钟,可以输出如下命令检查是否完成启动:

kubectl get deployments -n starwhale
NAMEREADYUP-TO-DATEAVAILABLEAGE
controller1/1115m
minio1/1115m
mysql1/1115m

本机访问的网络配置

输出如下命令后,就可以在浏览器中通过 http://controller.starwhale.svc 访问 Starwhale Server:

echo "$(sudo minikube ip) controller.starwhale.svc minio.starwhale.svc  minio-admin.starwhale.svc " | sudo tee -a /etc/hosts

其他机器访问的网络配置

  • 步骤1: 在 Starwhale Server 所在机器上

    使用 socat 命令做临时的端口转发,命令如下:

    # install socat at first, ref: https://howtoinstall.co/en/socat
    sudo socat TCP4-LISTEN:80,fork,reuseaddr,bind=0.0.0.0 TCP4:`minikube ip`:80

    当您停掉socat进程后,端口转发会被禁止,其他机器的访问也会被禁止。如果想长期开启端口转发,可以使用 iptables 命令。

  • 步骤2: 在其他机器上

    在 hosts 文件添加相关域名映射,命令如下:

    # for macOSX or Linux environment, run the command in the shell.
    echo ${your_machine_ip} controller.starwhale.svc minio.starwhale.svc minio-admin.starwhale.svc " | sudo tee -a /etc/hosts

    # for Windows environment, run the command in the PowerShell with administrator permission.
    Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "`n${your_machine_ip} controller.starwhale.svc minio.starwhale.svc minio-admin.starwhale.svc"