用于在Kubernetes环境下部署SuperMap web许可中心
203
使用以下编排在Kubernetes环境下部署Web许可中心,注意:部署前需要确定一个K8s节点来绑定许可中心Server(防止Pod漂移导致许可指纹失效),然后使用该K8s节点名称替换编排中 ${K8S_NODE_NAME} 再部署
kind: ConfigMap
apiVersion: v1
metadata:
labels:
type: icloud-native
name: timezone-config
data:
timezone: Asia/Shanghai
---
kind: ConfigMap
apiVersion: v1
metadata:
name: mysql-init-script
labels:
type: icloud-native
data:
init.sh: |
if [ "`ls /init_data`" = "" ]; then
/usr/local/bin/docker-entrypoint.sh mysqld;
cp -r /var/lib/mysql/* /init_data;
echo "copy finished"
else
echo "mysql already init"
fi
---
apiVersion: v1
kind: Service
metadata:
name: bslicense-server
labels:
type: imanager
kind: imanager-base
spec:
ports:
- port: 9183
targetPort: 9183
selector:
app: bslicense-server
type: NodePort
---
apiVersion: v1
kind: Service
metadata:
labels:
type: imanager
kind: imanager-base
name: bslicense-ui
spec:
ports:
- port: 9283
targetPort: 9283
selector:
app: bslicense-ui
type: NodePort
---
kind: ConfigMap
apiVersion: v1
metadata:
name: bslicense-mysql-config
labels:
type: imanager
kind: imanager-base
data:
my.cnf: |
[client]
port=3307
[mysqld]
port=3307
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: bslicense-server
type: imanager
kind: imanager-base
name: bslicense-server
annotations:
scale: unscalable
spec:
replicas: 1
selector:
matchLabels:
app: bslicense-server
strategy:
type: Recreate
template:
metadata:
labels:
app: bslicense-server
spec:
hostname: control-node
initContainers:
- name: mysql-init
image: supermap/mariadb:10.5.15-amd64
env:
- name: MYSQL_ROOT_PASSWORD
value: supermap
- name: MYSQL_DATABASE
value: bslicense
- name: MYSQL_USER
value: bslic
- name: MYSQL_PASSWORD
value: bslic
- name: INIT_ONLY
value: "true"
imagePullPolicy: Always
command: ["/bin/sh", "-c", "/opt/scripts/init.sh"]
volumeMounts:
- name: bslicense-mysql-volume
mountPath: /init_data
- mountPath: /etc/mysql/conf.d/my.cnf
subPath: my.cnf
name: bslicense-mysql-config-volume
- mountPath: /opt/scripts
name: mysql-init-script-volume
containers:
- name: bslicense-server
env:
- name: ICLOUD_NATIVE
value: "true"
- name: KEYCLOAK_ENABLED
value: "false"
- name: BSLICENSE_DB_URL
value: "jdbc:mysql://localhost:3307/bslicense?autoReconnect=true&useSSL=false&useUnicode=true&characterEncoding=utf8"
- name: BSLICENSE_DB_USERNAME
value: bslic
- name: BSLICENSE_DB_PASSWORD
value: bslic
- name: BSLICENSE_DB_PORT
value: "3307"
image: supermap/bslicense-server:11.0.1-amd64
imagePullPolicy: Always
resources:
limits:
cpu: '2'
memory: 4Gi
requests:
cpu: 100m
memory: 200Mi
ports:
- containerPort: 9183
livenessProbe:
tcpSocket:
port: 9183
initialDelaySeconds: 20
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 20
failureThreshold: 5
readinessProbe:
tcpSocket:
port: 9183
initialDelaySeconds: 20
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 20
failureThreshold: 5
volumeMounts:
- name: bslicense-mysql-volume
mountPath: /var/lib/mysql
- name: bslicense-server-db
env:
- name: MYSQL_ROOT_PASSWORD
value: supermap
- name: MYSQL_DATABASE
value: bslicense
- name: MYSQL_USER
value: bslic
- name: MYSQL_PASSWORD
value: bslic
- name: TZ
valueFrom:
configMapKeyRef:
name: timezone-config
key: timezone
image: supermap/mariadb:10.5.15-amd64
imagePullPolicy: Always
resources:
limits:
cpu: 1
memory: 2Gi
requests:
cpu: 100m
memory: 200Mi
ports:
- containerPort: 3307
readinessProbe:
exec:
command:
- /bin/sh
- -c
- mysql -u root -p$MYSQL_ROOT_PASSWORD -e 'SELECT 1'
failureThreshold: 30
initialDelaySeconds: 30
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 15
volumeMounts:
- name: bslicense-mysql-volume
mountPath: /var/lib/mysql
- mountPath: /etc/mysql/conf.d/my.cnf
subPath: my.cnf
name: bslicense-mysql-config-volume
restartPolicy: Always
nodeName: ${K8S-Node-NAME}
volumes:
- name: bslicense-mysql-volume
hostPath:
path: /opt/imanager-data/bslicense/data
- name: bslicense-mysql-config-volume
configMap:
name: bslicense-mysql-config
- name: mysql-init-script-volume
configMap:
name: mysql-init-script
defaultMode: 511
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: bslicense-ui
type: imanager
kind: imanager-base
name: bslicense-ui
annotations:
console: noconsole
scale: unscalable
portExpose: exposable
spec:
replicas: 1
selector:
matchLabels:
app: bslicense-ui
template:
metadata:
labels:
app: bslicense-ui
spec:
containers:
- env:
- name: BSLICENSE_SERVER
value: http://bslicense-server:9183
image: supermap/bslicense-ui:11.0.1-amd64
name: bslicense-ui
imagePullPolicy: Always
resources:
requests:
cpu: 10m
memory: 20Mi
limits:
cpu: 500m
memory: 512Mi
ports:
- containerPort: 9283
livenessProbe:
httpGet:
port: 9283
initialDelaySeconds: 5
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 20
failureThreshold: 5
readinessProbe:
httpGet:
port: 9283
initialDelaySeconds: 5
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 20
failureThreshold: 5
restartPolicy: Always
Content type
Image
Digest
sha256:83f4c3197…
Size
395.1 MB
Last updated
over 3 years ago
docker pull supermap/bslicense-server:11.0.1-amd64