美文网首页
安装k3s集成docker,rancher,loki

安装k3s集成docker,rancher,loki

作者: 9e8aeff1c70c | 来源:发表于2021-04-06 16:07 被阅读0次

环境使用ubuntu 20.04

  1. 安装docker
    Install Docker Engine on Ubuntu | Docker Documentation
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
  1. 安装k3s with docker
curl -sfL https://get.k3s.io | sh -s - --docker ----cluster-domain "taihu.org"

检查一下安装完毕

sudo k3s kubectl get pods --all-namespaces
  1. 安装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
  1. 配置KUBECONFIG
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
  1. 安装cert-manager
kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.2.0/cert-manager.yaml
  1. 安装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
  1. 配置host
    /etc/host
    加入
    127.0.0.1 rancher.taihu.org
    7.浏览器打开
    http://rancher.taihu.org

  2. 安装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

相关文章

网友评论

      本文标题:安装k3s集成docker,rancher,loki

      本文链接:https://www.haomeiwen.com/subject/hwpfkltx.html