镜像拉取
docker pull ihmhny/dubbo-admin
docker tag ihmhny/dubbo-admin 192.168.145.28:1603/lego/dubbo-admin:2.5.10
deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: dubbo-admin
namespace: dmgeo-lib
labels:
app: dubbo-admin
spec:
replicas: 1
selector:
matchLabels:
app: dubbo-admin
template:
metadata:
labels:
app: dubbo-admin
spec:
nodeName: k8s-n1
containers:
- name: dubbo-admin
#image: 192.168.145.28:1603/lego/dubboadmin:v0.1
image: 192.168.145.28:1603/lego/dubbo-admin:2.5.10
imagePullPolicy: IfNotPresent
env:
- name: REGISTRY_ADDRESS
value: zookeeper://192.168.145.19:2181
- name: ROOT_PSD
value: 123456 #默认root/root
- name: GUEST_PSD
value: 123456 #默认guest/guest
#command: [ "/bin/bash", "-ce", "java -Dadmin.registry.address=zookeeper://192.168.145.19:2181 -Dadmin.config-center=zookeeper://192.168.145.19:2181 -Dadmin.metadata-report.address=zookeeper://192.168.145.19:2181 -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Djava.security.egd=file:/dev/./urandom -jar /app.jar"]
#readinessProbe:
# tcpSocket:
# port: 8080
# initialDelaySeconds: 60
# periodSeconds: 20
---
apiVersion: v1
kind: Service
metadata:
name: dubbo-admin
namespace: dmgeo-lib
labels:
app: dubbo-admin
spec:
selector:
app: dubbo-admin
type: NodePort
ports:
- name: dubbo-admin-80
port: 80
targetPort: 8080
nodePort: 28080
docker镜像相关配置
docker run -dit -p 28080:8080 -e REGISTRY_ADDRESS=zookeeper://192.168.145.19:2181 -e ROOT_PSD=Hust@4400 -e GUEST_PSD=Hust@4400 -e HTTP_CONNECTOR_PORT=8080 --name dubbo-admin 192.168.145.28:1603/lego/dubbo-admin:2.5.10
缺省配置
默认的访问端口是8080,默认的注册中心地址为:zookeeper://127.0.0.1:2181,默认用户名密码为 root:root,guest:guest
直接启动
docker run -d --name dubbo-admin ihmhny/dubbo-admin:2.5.10
与主机的8080端口做映射启动
docker run -d -p 8080:8080 --name dubbo-admin ihmhny/dubbo-admin:2.5.10
指定注册中心启动
可以设置环境变量REGISTRY_ADDRESS,用于指定注册中心地址
docker run -d -e REGISTRY_ADDRESS=zookeeper://10.1.121.10:2181 --name dubbo-admin ihmhny/dubbo-admin:2.5.10
修改默认的用户名和密码启动
可以设置环境变量ROOT_PSD修改root用户密码,设置环境变量GUEST_PSD修改guest用户密码
docker run -d -e ROOT_PSD=rootTest -e GUEST_PSD=guestTest -e HTTP_CONNECTOR_PORT=8081 --name dubbo-admin ihmhny/dubbo-admin:2.5.10
修改默认的访问端口启动
可以设置环境变量HTTP_CONNECTOR_PORT修改http请求端口
docker run -d -e HTTP_CONNECTOR_PORT=8081 --name dubbo-admin ihmhny/dubbo-admin:2.5.10