k8s安装yearning

本文章用于安装v3.1.7版本

创建数据库

CREATE DATABASE `yearning` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
CREATE USER 'yearning_db'@'%' IDENTIFIED BY 'xxxxxx';
GRANT ALL PRIVILEGES ON yearning.* TO 'yearning_db'@'%';
flush privileges;

编写yaml文件

yearning.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: yearning
  name: yearning
spec:
  replicas: 1
  selector:
    matchLabels:
      app: yearning
  template:
    metadata:
      labels:
        app: yearning
    spec:
      containers:
        - name: yearning
          image: yeelabs/yearning:v3.1.7
          ports:
            - name: http-8000
              containerPort: 8000
              protocol: TCP
          env:
            - name: MYSQL_USER
              value: 'yearning_db'
            - name: MYSQL_ADDR
              value: 'ip:port'
            - name: MYSQL_PASSWORD
              value: 'xxxxxx'
            - name: MYSQL_DB
              value: yearning
            - name: SECRET_KEY
              value: akanoneedakanone    #自定义
          resources:
            limits:
              memory: 2048Mi
            requests:
              memory: 1024Mi
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: yearning
  name: yearning
spec:
  ports:
  - name: http-8000
    port: 8000
    protocol: TCP
    targetPort: 8000
  selector:
    app: yearning

启动容器

kubectl -n xxx apply -f yearning.yaml

等待容器创建完成后,可以执行以下操作。

插入必要数据

INSERT INTO `core_accounts` (`username`,`password`,`department`,`real_name`,`email`,`is_recorder`) VALUES ('admin','pbkdf2_sha256$120000$LwSop65y17f4$AgXGkzmZLF7Lw3K1gToLkOBHqziBC0Wpf3bBIHoWA5Q=','DBA','超级管理员','',0);
INSERT INTO `core_global_configurations` (`authorization`,`ldap`,`message`,`other`,`stmt`,`audit_role`,`board`) VALUES ('global','{"url":"","user":"","password":"","type":"(\u0026(objectClass=organizationalPerson)   (sAMAccountName=%s))","sc":"","ldaps":false,"map":"","test_user":"","test_password":""}','{"web_hook":"","host":"","port":25,"user":"","password":"","to_user":"","mail":false,"ding":false,"ssl":false,"push_type":false,"key":""}','{"limit":1000,"idc":["Aliyun","AWS"],"query":false,"register":false,"export":false,"ex_query_time":60}',0,'{"DMLAllowLimitSTMT":false,"DMLInsertColumns":false,"DMLMaxInsertRows":10,"DMLWhere":false,"DMLAllowInsertNull":false,"DMLOrder":false,"DMLSelect":false,"DMLInsertMustExplicitly":false,"DDLEnablePrimaryKey":false,"DDLCheckTableComment":false,"DDlCheckColumnComment":false,"DDLCheckColumnNullable":false,"DDLCheckColumnDefault":false,"DDLEnableAcrossDBRename":false,"DDLEnableAutoincrementInit":false,"DDLEnableAutoIncrement":false,"DDLEnableAutoincrementUnsigned":false,"DDLEnableDropTable":false,"DDLEnableDropDatabase":false,"DDLEnableNullIndexName":false,"DDLIndexNameSpec":false,"DDLMaxKeyParts":5,"DDLMaxKey":5,"DDLMaxCharLength":10,"MaxTableNameLen":10,"MaxAffectRows":1000,"MaxDDLAffectRows":0,"SupportCharset":"","SupportCollation":"","CheckIdentifier":false,"MustHaveColumns":"","DDLMultiToCommit":false,"DDLPrimaryKeyMust":false,"DDLAllowColumnType":false,"DDLImplicitTypeConversion":false,"DDLAllowPRINotInt":false,"DDLEnableForeignKey":false,"DDLTablePrefix":"","DDLColumnsMustHaveIndex":"","DDLAllowChangeColumnPosition":false,"DDLCheckFloatDouble":false,"IsOSC":false,"OSCExpr":"","OscSize":0,"AllowCreateView":false,"AllowCrateViewWithSelectStar":false,"AllowCreatePartition":false,"AllowSpecialType":false,"PRIRollBack":false}','');
INSERT INTO `core_graineds` (`username`,`group`) VALUES ('admin','["admin"]');

如果上面的sql执行失败,可以进入到容器的命令行,直接执行

./Yearning install

执行完成后,再次执行以上sql

访问

http://ip:8000
账号密码: admin / Yearning_admin

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值