环境使用ubuntu 20.04
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
- 安装k3s with docker
curl -sfL https://get.k3s.io | sh -s - --docker ----cluster-domain "taihu.org"
检查一下安装完毕
sudo k3s kubectl get pods --all-namespaces
- 安装helm
https://github.com/helm/helm/releases
下载
解压
tar -zxvf helm-v3.0.0-linux-amd64.tar.gz
移动到位置
mv linux-amd64/helm /usr/local/bin/helm
- 配置KUBECONFIG
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
- 安装cert-manager
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.2.0/cert-manager.yaml
- 安装rancher
helm repo add rancher-stable https://releases.rancher.com/server-charts/stable
kubectl create namespace cattle-system
helm install rancher rancher-stable/rancher \
--namespace cattle-system \
--set hostname=rancher.taihu.org
-
配置host
/etc/host
加入
127.0.0.1 rancher.taihu.org
7.浏览器打开
http://rancher.taihu.org -
安装loki
kubectl create namespace loki
helm upgrade --install loki -namspace loki grafana/loki-stack --set grafana.enabled=true,prometheus.enabled=true,prometheus.alertmanager.persistentVolume.enabled=false,prometheus.server.persistentVolume.enabled=false
进入rancher界面,配置ingress
设置域名是grafana.taihu.org
映射到服务是grafana
然后在/etc/hosts 里追加
grafana.taihu.org
127.0.0.1 rancher.taihu.org grafana.taihu.org
网友评论