跳转至

Kubernetes部署

k8s 部署

目前仅支持 helm chart 的方式部署, 欢迎贡献其他部署方式

本文档是从 archery chart readme 中摘录而来, 如有条件请直接阅读 archery chart 的 readme

安装 helm

参考 helm文档 安装 helm 最新版, 右上角可切换语言

安装 archery chart

  1. helm repo add douban https://douban.github.io/charts/ 将 helm chart 增加至 repo
  2. kubectl create ns archery 新建 ns
  3. 定制 my-values.yaml 下面是一个范例, 完整的values 及说明请参考 : https://github.com/douban/charts/blob/master/charts/archery/values.yaml
    image:
      repository: hhyo/archery # 如果你有二次开发, 改成你自己的 repo
      tag: v1.9.1 # 改到最新版, 或者你想要的版本
    
    ingress:
      enabled: true # 启用 ingress
      className: "nginx"
      paths:
        - /
      servicePort: 9123
    
      hosts:
        - my-redis.example.com # 你的ingress 域名
    
    # 下面是两个内置的 redis 实例和 mysql 实例, 对 k8s 不熟的, 建议就不要用内置的, 维护起来不是很方便
    # subcharts redis
    redis:
      embedded: true
      # 也可以将 embedded 改成 false, 这里直接写连接串
      # url: "redis://127.0.0.1:6379/0"
      # dingdingUrl: "redis://127.0.0.1:6379/1"
    # subcharts mysql
    mysql:
      embedded: true
      # 这里 mysql 也是类似的
      # url: "mysql://root:@127.0.0.1:3306/archery"
    configMap:
      enabled: true
      # admin password
      superuser:
        username: admin
        password: archery  # 默认密码, 请尽快修改
        email: "[email protected]" # 超级管理员邮箱, 建议改成内网的邮箱
      data:
        # local_settings , 可以覆盖之前的所有 django settings 配置, python 代码, 灵活性很高
        # 但是也容易出错, 建议慎重
        local_settings.py: |-
            # -*- coding: UTF-8 -*-
            # override your configs here
    
  4. helm install --upgrade archery douban/archery -f my-values.yaml 安装 helm chart
  5. 使用在 values 内定义的 ingress 网址访问网站, 使用 values 内的超级管理员账号登录.

删除 archery

  1. 删除 chart helm -n archery uninstall archery
  2. 删除 namespace kubectl delete ns archery
Back to top