k8s 部署 yearning
1. 下载镜像
docker pull zhangsean/yearning:v3.1.2.2
2. yaml 文件
apiVersion: apps/v1 kind: Deployment metadata: name: yearning spec: replicas: 1 selector: matchLabels: app: yearning template: metadata: labels: app: yearning spec: containers: - name: yearning image: 'docker.io/library/yearning:3.1.2' imagePullPolicy: IfNotPresent ports: - containerPort: 8000 env: - name: MYSQL_ADDR value: '10.20.0.3:3306' - name: MYSQL_USER value: "root" - name: MYSQL_PASSWORD value: "VPMmLsnfNhtoYIkE" - name: MYSQL_DB value: "yearning" - name: SECRET_KEY value: "VPMmLsnfNhtoYIkE" --- apiVersion: v1 kind: Service metadata: name: yearning spec: ports: - name: http-8000 port: 8000 protocol: TCP targetPort: 8000 nodePort: 30625 selector: app: yearning type: NodePort
3. 启动yaml
kubectl create -f yearning.yaml
4. sql 插入
## 需要创建对应的 DB - yearning CREATE DATABASE `yearning` /*!40100 DEFAULT CHARACTER SET utf8mb4 */; use yearning; 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"]');
5. 重新启动yaml 文件, 打开浏览器登录http://ip:30625
6. 账号密码 : admin/Yearning_admin