#下载镜像
docker pull mysql
docker pull 360cloud/wayne-backend
docker pull 360cloud/wayne-frontend
#创建工作目录
mkdir -p /home/wayne/data
mkdir -p /home/wayne/logs
mkdir -p /home/wayne/conf
#上传配置文件,配置文件见附件
#修改配置文件config.js
#将里面的youip改成本机的Ip地址即可。
#添加网络段
docker network create wayne
#启动Mysql:
docker run -d -p 3306:3306 --name mysql --restart=always \
--network wayne -e MYSQL_ROOT_PASSWORD=root \
-v $PWD/data:/var/lib/mysql \
-v $PWD/logs:/logs \
mysql
#启动后台:
docker run -d -p 8080:8080 --name wayne-backend --restart=always \
--network wayne -e GOPATH="/go" \
-v $PWD/conf/app.conf:/opt/wayne/conf/app.conf \
-v /etc/hosts:/etc/hosts \
360cloud/wayne-backend /opt/wayne/backend
#启动前台:
docker run -d -p 4200:80 --name wayne-frontend --restart=always \
--network wayne \
-v $PWD/conf/config.js:/usr/local/openresty/nginx/html/config.js \
-v /etc/hosts:/etc/hosts \
360cloud/wayne-frontend

最后,登录wayne,连接K8s即可

http://localhost:4200,默认用户密码admin:admin

如何关联K8S集群?

1、修改/etc/hosts,添加K8S集群的域名地址解析

echo 10.41.XX.XX apiserver.cluster.local >> /etc/hosts

2、重启wayne-frontend与wayne-backend容器

docker restart wayne-frontend
docker restart wayne-backend

3、获取K8S的配置信息

kubectl config view #这里看不到具体的证书数据
cat /root/.kube/config #这里可以看到所有信息
#有的配置可能在/etc/kubernetes/kubelet.*里面,具体可视情况而定。

进入wayne,进入后台-集群-关联集群,将以上获取到的信息配置到wayne的系统里,关联K8S。

完成!

配置文件附件

conf/app.conf

appname = wayne
httpport = 8080
runmode = prod
autorender = false
copyrequestbody = true
EnableDocs = true
EnableAdmin = true
StaticDir = public:static

# Custom config
ShowSql = false

## if enable username and password login
EnableDBLogin = true

# token, generate jwt token
RsaPrivateKey = "./apikey/rsa-private.pem"
RsaPublicKey = "./apikey/rsa-public.pem"

# token end time. second
TokenLifeTime=86400

# kubernetes labels config
AppLabelKey= wayne-app
NamespaceLabelKey = wayne-ns
PodAnnotationControllerKindLabelKey = wayne.cloud/controller-kind

# database configuration:
## mysql
DBName = "wayne"
DBTns = "tcp(mysql:3306)"
DBUser = "root"
DBPasswd = "root"
DBLoc = "Asia%2FShanghai"
DBConnTTL = 30

# web shell auth
appKey = "860af247a91a19b2368d6425797921c6"

# Set demo namespace and group id
DemoGroupId = "1"
DemoNamespaceId = "1"

# Sentry
LogLevel = "4"
SentryEnable = false
SentryDSN = ""
SentryLogLevel = "4"

# Robin
EnableRobin = false

# api-keys
EnableApiKeys = true

# Bus
EnableWebhook = true
BusEnable = true

# Webhook
EnableWebhook = true
WebhookClientTimeout = 10
WebhookClientWindowSize = 16

# other
# Use Canary/Production Update
# If set app metaData {"mode":"beta"},the app will auto redirect to BetaUrl
BetaUrl = ""
AppUrl = ""

# oauth2
[auth.oauth2]
enabled = false
redirect_url = "https://www.wayne.cloud"
client_id = client
client_secret = secret
auth_url = https://example.com/oauth2/v1/authorize
token_url = https://example.com/oauth2/v1/token
api_url = https://example.com/oauth2/v1/userinfo
# If your OAuth 2.0-based authorization service does not have email, name, and dispaly fields, use mapping criteria.
api_mapping = name:name,email:email,display:display

# ldap config
# enable ldap login
[auth.ldap]
enabled = false
ldap_url = ldap://127.0.0.1
ldap_search_dn = "cn=admin,dc=example,dc=com"
ldap_search_password = admin
ldap_base_dn = "dc=example,dc=com"
ldap_filter =
ldap_uid = cn
ldap_scope = 2
ldap_connection_timeout = 30

config.js

window.CONFIG = {
    URL: 'http://当前IP:8080',
    RAVEN: false,
    RAVEN_DSN: 'RAVEN_DSN'
};
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐