目录
2.2、通过kubesphere页面存储-持久卷声明查看创建结果
环境准备
Kubernetes 集群版本v1.22.10
kubesphere环境
需要的docker镜像
1、创建k8s的namespace和ConfigMap
yaml配置文件1shenyu-ns.yaml
1.1、执行命令
kubectl apply -f 1shenyu-ns.yaml
kubectl delete -f 1shenyu-ns.yaml
1.2、文件内容:
apiVersion: v1
kind: Namespace
metadata:
name: shenyu
labels:
name: shenyu
---
apiVersion: v1
kind: ConfigMap
metadata:
name: shenyu-cm
namespace: shenyu
data:
application-local.yml: |
server:
port: 9195
address: 0.0.0.0
spring:
main:
allow-bean-definition-overriding: true
application:
name: shenyu-bootstrap
management:
health:
defaults:
enabled: false
shenyu:
local:
enabled: true
file:
enabled: true
cross:
enabled: true
dubbo:
parameter: multi
sync:
websocket:
urls: ws://shenyu-admin-svc:9095/websocket
exclude:
enabled: false
paths:
- /favicon.ico
extPlugin:
enabled: true
threads: 1
scheduleTime: 300
scheduleDelay: 30
scheduler:
enabled: false
type: fixed
threads: 16
logging:
level:
root: info
org.springframework.boot: info
org.apache.ibatis: info
org.apache.shenyu.bonuspoint: info
org.apache.shenyu.lottery: info
org.apache.shenyu: info
application-demo.yml: |
server:
servlet:
context-path: /
port: 8090
spring:
main:
allow-bean-definition-overriding: true
application:
name: boot-demo
security:
user:
name: admin
password: 123456
sql:
init:
schema-locations:
- classpath*:sql/demo.sql
continue-on-error: false
username: root
password: 123456
separator: ;
encoding: UTF-8
mode: always
platform: all
datasource:
username: root
password: 123456
url: jdbc:mysql://mysql:3306/demo?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&useSSL=false
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
druid:
initial-size: 5
min-idle: 5
max-active: 20
max-wait: 60000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
filters: stat,wall
use-global-data-source-stat: true
management:
endpoints:
web:
exposure:
include: "*"
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
global-config:
db-config:
id-type: AUTO
configuration:
map-underscore-to-camel-case: true
call-setters-on-nulls: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
cache-enabled: true
database-id: mysql
application-mysql.yml: |
spring.datasource.url: jdbc:mysql://mysql:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username: root
spring.datasource.password: 123456
my.cnf: |
[client]
socket=/var/run/mysqld/mysqld.sock
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
bind-address=0.0.0.0
port=3306
server-id=1
skip-host-cache
skip-name-resolve
datadir=/var/lib/mysql
socket=/var/run/mysqld/mysqld.sock
secure-file-priv=/var/lib/mysql-files
user=mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysqld/mysqld.sock
basedir=/var/lib/mysql
datadir=/var/lib/mysql/data
symbolic-links=0
skip_name_resolve
log_bin=mysql-bin
binlog_format=mixed
expire_logs_days=30
init_connect='SET collation_connection = utf8mb4_unicode_ci'
init_connect='SET NAMES utf8mb4'
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
default-time_zone='+8:00'
skip-character-set-client-handshake
max_connections=1000
max_connect_errors = 6000
1.3、查看ConfigMap创建情况
kubectl get configmap shenyu-cm -n shenyu -o yaml
或者通过k