本地快速搭建测试Botkube

360 阅读1分钟

Local Setup

System: centos7

  1. pull botkube code

    git clone -b release-1.0 https://github.com/kubeshop/botkube.git
    
  2. download binary

    go mod tidy
    
  3. build binary

    go build ./cmd/botkube/
    
  4. create a local configuration file to override default values (create slack app)

    cat > local_config.yaml << EOF
    communications:
      default-group:
        socketSlack:
          enabled: true
          channels:
            default:
              name: botkube
          appToken: "xapp-xxxxxxxxxxxxxx"
          botToken: "xoxb-xxxxxxxxxxxxxx"
    configWatcher:
      enabled: false
    settings:
      clusterName: "labs"
    analytics:
      # -- If true, sending anonymous analytics is disabled. To learn what date we collect,
      # see [Privacy Policy](https://botkube.io/privacy#privacy-policy).
      disable: true
    EOF
    
  5. Add values.yaml

    values.yaml 提取码:"5rlp"

  6. export the path to the configuration file

    export BOTKUBE_CONFIG_PATHS="/root/xxx/code/values.yaml,/root/xxx/code/local_config.yaml"
    
  7. export the path to kubeconfig

    export BOTKUBE_SETTINGS_KUBECONFIG=/root/.kube/config
    
  8. if this is a demo deployment of Botkube and does have not a Kubernetes cluster locally, you can do that: install K3s.

  9. make sure you are able to access your k8s cluster

    kubectl cluster-info
    
  10. run botkube application

    ./botkube
    
  11. make sure your Slack is able to access your Botkube

setup botkube-proxy (nginx)

  1. install docker
yum install -y docker
systemctl enable docker
systemctl start docker
  1. pull nginx
docker pull nginx
  1. docker setup nginx via mount configuration file nginx.conf, default.d, botkube-pluginxs to container lib, expose container port 80 to local port 8080.
docker run --name botkube-proxy -d -v /root/xxx/nginx/nginx.conf:/etc/nginx/nginx.conf -v /root/xxx/nginx/default.conf:/etc/nginx/conf.d/default.conf -v /root/xxx/botkube-plugins:/home/ -p 8080:8080 nginx
  1. build the demo executors and sources of Botkube plugins

refer

blog.csdn.net/qq_42684504…

www.jianshu.com/p/b92d4b845…