KubeSphere部署中间件


中间件部署

MySQL

容器启动

支持变量参考:MySQL5.7变量
例子:

  • MYSQL_ROOT_PASSWORD root 用户密码
  • MYSQL_DATABASE 新建库
  • MYSQL_USER 新建用户
  • MYSQL_PASSWORD 新建用户的密码
docker run -p 3306:3306 --name mysql-01 \
-v /data/mysql/log:/var/log/mysql \
-v /data/mysql/data:/var/lib/mysql \
-v /data/mysql/conf:/etc/mysql/conf.d \
-e MYSQL_ROOT_PASSWORD=123456 \
--restart=always \
-d mysql:5.7.38
[client]
default-character-set=utf8mb4
 
[mysql]
default-character-set=utf8mb4
 
[mysqld]
init_connect='SET collation_connection = utf8mb4_unicode_ci'
init_connect='SET NAMES utf8mb4'
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
skip-character-set-client-handshake
skip-name-resolve

部署分析

KubeSphere部署中间件_第1张图片

KubeSphere部署

1. 创建ConfigMap

KubeSphere部署中间件_第2张图片
KubeSphere部署中间件_第3张图片
KubeSphere部署中间件_第4张图片

2. 创建有状态工作负载(StatefulSet)

KubeSphere部署中间件_第5张图片
KubeSphere部署中间件_第6张图片
KubeSphere部署中间件_第7张图片
KubeSphere部署中间件_第8张图片
KubeSphere部署中间件_第9张图片

配置持久化

KubeSphere部署中间件_第10张图片
KubeSphere部署中间件_第11张图片
KubeSphere部署中间件_第12张图片
KubeSphere部署中间件_第13张图片

KubeSphere部署中间件_第14张图片
KubeSphere部署中间件_第15张图片
KubeSphere部署中间件_第16张图片

  1. 暴露服务–集群内部

创建有状态负载后会默认创建出service,供集群内部访问使用

KubeSphere部署中间件_第17张图片

  1. 暴露服务–集群外部

KubeSphere部署中间件_第18张图片
KubeSphere部署中间件_第19张图片
KubeSphere部署中间件_第20张图片
KubeSphere部署中间件_第21张图片
KubeSphere部署中间件_第22张图片
KubeSphere部署中间件_第23张图片
KubeSphere部署中间件_第24张图片
KubeSphere部署中间件_第25张图片

连接测试

image.png

Redis

容器启动

:::success
需要自定义启动命令,指定配置文件的位置
:::

#创建配置文件
## 1、准备redis配置文件内容
mkdir -p /mydata/redis/conf && vim /mydata/redis/conf/redis.conf


##配置示例
appendonly yes
port 6379
bind 0.0.0.0


#docker启动redis
docker run -d -p 6379:6379 --restart=always \
-v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf \
-v  /mydata/redis-01/data:/data \
 --name redis-01 redis:6.2.5 \
 redis-server /etc/redis/redis.conf

部署分析

KubeSphere部署中间件_第26张图片

KubeSphere部署

1. 创建ConfigMap

KubeSphere部署中间件_第27张图片
KubeSphere部署中间件_第28张图片
KubeSphere部署中间件_第29张图片

2. 创建有状态工作负载(StatefulSet)

KubeSphere部署中间件_第30张图片
KubeSphere部署中间件_第31张图片
KubeSphere部署中间件_第32张图片
KubeSphere部署中间件_第33张图片
KubeSphere部署中间件_第34张图片
KubeSphere部署中间件_第35张图片
KubeSphere部署中间件_第36张图片
KubeSphere部署中间件_第37张图片
KubeSphere部署中间件_第38张图片
KubeSphere部署中间件_第39张图片

3.创建Service

KubeSphere部署中间件_第40张图片
KubeSphere部署中间件_第41张图片
KubeSphere部署中间件_第42张图片
KubeSphere部署中间件_第43张图片

4. 访问

KubeSphere部署中间件_第44张图片

ElasticSearch

容器启动

# 创建数据目录
mkdir -p /mydata/es-01 && chmod 777 -R /mydata/es-01

# 容器启动
docker run --restart=always -d -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms512m -Xmx512m" \
-v es-config:/usr/share/elasticsearch/config \
-v /data/es-01/data:/usr/share/elasticsearch/data \
--name es-01 \
elasticsearch:7.13.4

部署分析

KubeSphere部署中间件_第45张图片

KubeSphere部署

  • 注意:同一路径下需要挂载多个文件,但挂载目录下还有其他文件需要保留,此时需要使用使用“挂载子路径”方式

1. 创建ConfigMap

KubeSphere部署中间件_第46张图片
KubeSphere部署中间件_第47张图片
KubeSphere部署中间件_第48张图片

cluster.name: "docker-cluster"
network.host: 0.0.0.0

KubeSphere部署中间件_第49张图片
KubeSphere部署中间件_第50张图片

################################################################
##
## JVM configuration
##
################################################################
##
## WARNING: DO NOT EDIT THIS FILE. If you want to override the
## JVM options in this file, or set any additional options, you
## should create one or more files in the jvm.options.d
## directory containing your adjustments.
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/jvm-options.html
## for more information.
##
################################################################



################################################################
## IMPORTANT: JVM heap size
################################################################
##
## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## and the min and max should be set to the same value. For
## example, to set the heap to 4 GB, create a new file in the
## jvm.options.d directory containing these lines:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################


################################################################
## Expert settings
################################################################
##
## All settings below here are considered expert settings. Do
## not adjust them unless you understand what you are doing. Do
## not edit them in this file; instead, create a new file in the
## jvm.options.d directory containing your adjustments.
##
################################################################

## GC configuration
8-13:-XX:+UseConcMarkSweepGC
8-13:-XX:CMSInitiatingOccupancyFraction=75
8-13:-XX:+UseCMSInitiatingOccupancyOnly

## G1GC Configuration
# NOTE: G1 GC is only supported on JDK version 10 or later
# to use G1GC, uncomment the next two lines and update the version on the
# following three lines to your version of the JDK
# 10-13:-XX:-UseConcMarkSweepGC
# 10-13:-XX:-UseCMSInitiatingOccupancyOnly
14-:-XX:+UseG1GC

## JVM temporary directory
-Djava.io.tmpdir=${ES_TMPDIR}

## heap dumps

# generate a heap dump when an allocation from the Java heap fails; heap dumps
# are created in the working directory of the JVM unless an alternative path is
# specified
-XX:+HeapDumpOnOutOfMemoryError

# specify an alternative path for heap dumps; ensure the directory exists and
# has sufficient space
-XX:HeapDumpPath=data

# specify an alternative path for JVM fatal error logs
-XX:ErrorFile=logs/hs_err_pid%p.log

## JDK 8 GC logging
8:-XX:+PrintGCDetails
8:-XX:+PrintGCDateStamps
8:-XX:+PrintTenuringDistribution
8:-XX:+PrintGCApplicationStoppedTime
8:-Xloggc:logs/gc.log
8:-XX:+UseGCLogFileRotation
8:-XX:NumberOfGCLogFiles=32
8:-XX:GCLogFileSize=64m

# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m

KubeSphere部署中间件_第51张图片

2. 创建有状态工作负载(StatefulSet)

KubeSphere部署中间件_第52张图片
KubeSphere部署中间件_第53张图片
KubeSphere部署中间件_第54张图片
KubeSphere部署中间件_第55张图片
KubeSphere部署中间件_第56张图片

discovery.type = single-node
ES_JAVA_OPTS = -Xms512m -Xmx512m

KubeSphere部署中间件_第57张图片
KubeSphere部署中间件_第58张图片
/usr/share/elasticsearch/data
KubeSphere部署中间件_第59张图片
KubeSphere部署中间件_第60张图片
KubeSphere部署中间件_第61张图片
KubeSphere部署中间件_第62张图片
KubeSphere部署中间件_第63张图片
KubeSphere部署中间件_第64张图片
KubeSphere部署中间件_第65张图片

3.创建Service

KubeSphere部署中间件_第66张图片
KubeSphere部署中间件_第67张图片
KubeSphere部署中间件_第68张图片
KubeSphere部署中间件_第69张图片
KubeSphere部署中间件_第70张图片
KubeSphere部署中间件_第71张图片

4.访问

KubeSphere部署中间件_第72张图片

RabbitMQ–应用商店

:::success
应用数量有限、版本有限
:::

1. 部署

KubeSphere部署中间件_第73张图片
KubeSphere部署中间件_第74张图片
KubeSphere部署中间件_第75张图片
KubeSphere部署中间件_第76张图片

2. 创建Service

KubeSphere部署中间件_第77张图片
KubeSphere部署中间件_第78张图片
KubeSphere部署中间件_第79张图片
KubeSphere部署中间件_第80张图片
KubeSphere部署中间件_第81张图片

3.访问

KubeSphere部署中间件_第82张图片
KubeSphere部署中间件_第83张图片

Harbor–应用商店

IP访问

1. 部署

KubeSphere部署中间件_第84张图片
KubeSphere部署中间件_第85张图片
KubeSphere部署中间件_第86张图片
KubeSphere部署中间件_第87张图片
KubeSphere部署中间件_第88张图片
KubeSphere部署中间件_第89张图片
KubeSphere部署中间件_第90张图片
KubeSphere部署中间件_第91张图片

2. 访问

KubeSphere部署中间件_第92张图片
KubeSphere部署中间件_第93张图片

域名访问http

使用默认域名

1. 配置
expose:
  type: ingress
  tls:
    enabled: false
externalURL: 'http://core.harbor.domain'
harborAdminPassword: Harbor12345

2.访问

配置本地hosts

KubeSphere部署中间件_第94张图片
KubeSphere部署中间件_第95张图片
KubeSphere部署中间件_第96张图片

自定义域名

1. 配置
expose:
  type: ingress
  tls:
    enabled: false
...
  ingress:
    hosts:
      core: harbor.test.com
      notary: notary.test.com
...
externalURL: 'http://harbor.test.com'
harborAdminPassword: Harbor12345
...

KubeSphere部署中间件_第97张图片

2.访问

配置本地hosts

KubeSphere部署中间件_第98张图片
KubeSphere部署中间件_第99张图片
KubeSphere部署中间件_第100张图片

Nacos–应用仓库

1.集群 2.0.2

1.部署MySQL

:::info
操作见本文档第一部分
:::

2.建库、用户

create user 'nacos'@'%' identified by '123456';

CREATE DATABASE IF NOT EXISTS `nacos` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci';

grant all privileges on nacos.* to 'nacos'@'%' identified by '123456';

FLUSH PRIVILEGES;

3.执行sql

/*
 * Copyright 1999-2018 Alibaba Group Holding Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info   */
/******************************************/
CREATE TABLE `config_info` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) NOT NULL COMMENT 'data_id',
  `group_id` varchar(255) DEFAULT NULL,
  `content` longtext NOT NULL COMMENT 'content',
  `md5` varchar(32) DEFAULT NULL COMMENT 'md5',
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `src_user` text COMMENT 'source user',
  `src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
  `app_name` varchar(128) DEFAULT NULL,
  `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
  `c_desc` varchar(256) DEFAULT NULL,
  `c_use` varchar(64) DEFAULT NULL,
  `effect` varchar(64) DEFAULT NULL,
  `type` varchar(64) DEFAULT NULL,
  `c_schema` text,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info';

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info_aggr   */
/******************************************/
CREATE TABLE `config_info_aggr` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) NOT NULL COMMENT 'data_id',
  `group_id` varchar(255) NOT NULL COMMENT 'group_id',
  `datum_id` varchar(255) NOT NULL COMMENT 'datum_id',
  `content` longtext NOT NULL COMMENT '内容',
  `gmt_modified` datetime NOT NULL COMMENT '修改时间',
  `app_name` varchar(128) DEFAULT NULL,
  `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='增加租户字段';


/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info_beta   */
/******************************************/
CREATE TABLE `config_info_beta` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) NOT NULL COMMENT 'data_id',
  `group_id` varchar(128) NOT NULL COMMENT 'group_id',
  `app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
  `content` longtext NOT NULL COMMENT 'content',
  `beta_ips` varchar(1024) DEFAULT NULL COMMENT 'betaIps',
  `md5` varchar(32) DEFAULT NULL COMMENT 'md5',
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `src_user` text COMMENT 'source user',
  `src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
  `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta';

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_info_tag   */
/******************************************/
CREATE TABLE `config_info_tag` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `data_id` varchar(255) NOT NULL COMMENT 'data_id',
  `group_id` varchar(128) NOT NULL COMMENT 'group_id',
  `tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',
  `tag_id` varchar(128) NOT NULL COMMENT 'tag_id',
  `app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
  `content` longtext NOT NULL COMMENT 'content',
  `md5` varchar(32) DEFAULT NULL COMMENT 'md5',
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  `src_user` text COMMENT 'source user',
  `src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_tag';

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = config_tags_relation   */
/******************************************/
CREATE TABLE `config_tags_relation` (
  `id` bigint(20) NOT NULL COMMENT 'id',
  `tag_name` varchar(128) NOT NULL COMMENT 'tag_name',
  `tag_type` varchar(64) DEFAULT NULL COMMENT 'tag_type',
  `data_id` varchar(255) NOT NULL COMMENT 'data_id',
  `group_id` varchar(128) NOT NULL COMMENT 'group_id',
  `tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',
  `nid` bigint(20) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`nid`),
  UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`),
  KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_tag_relation';

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = group_capacity   */
/******************************************/
CREATE TABLE `group_capacity` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `group_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群',
  `quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
  `usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
  `max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
  `max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数,,0表示使用默认值',
  `max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
  `max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='集群、各Group容量信息表';

/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = his_config_info   */
/******************************************/
CREATE TABLE `his_config_info` (
  `id` bigint(64) unsigned NOT NULL,
  `nid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `data_id` varchar(255) NOT NULL,
  `group_id` varchar(128) NOT NULL,
  `app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
  `content` longtext NOT NULL,
  `md5` varchar(32) DEFAULT NULL,
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `src_user` text,
  `src_ip` varchar(50) DEFAULT NULL,
  `op_type` char(10) DEFAULT NULL,
  `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
  PRIMARY KEY (`nid`),
  KEY `idx_gmt_create` (`gmt_create`),
  KEY `idx_gmt_modified` (`gmt_modified`),
  KEY `idx_did` (`data_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='多租户改造';


/******************************************/
/*   数据库全名 = nacos_config   */
/*   表名称 = tenant_capacity   */
/******************************************/
CREATE TABLE `tenant_capacity` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `tenant_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Tenant ID',
  `quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值',
  `usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
  `max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
  `max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数',
  `max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
  `max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
  `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='租户容量信息表';


CREATE TABLE `tenant_info` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `kp` varchar(128) NOT NULL COMMENT 'kp',
  `tenant_id` varchar(128) default '' COMMENT 'tenant_id',
  `tenant_name` varchar(128) default '' COMMENT 'tenant_name',
  `tenant_desc` varchar(256) DEFAULT NULL COMMENT 'tenant_desc',
  `create_source` varchar(32) DEFAULT NULL COMMENT 'create_source',
  `gmt_create` bigint(20) NOT NULL COMMENT '创建时间',
  `gmt_modified` bigint(20) NOT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`),
  KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';

CREATE TABLE `users` (
	`username` varchar(50) NOT NULL PRIMARY KEY,
	`password` varchar(500) NOT NULL,
	`enabled` boolean NOT NULL
);

CREATE TABLE `roles` (
	`username` varchar(50) NOT NULL,
	`role` varchar(50) NOT NULL,
	UNIQUE INDEX `idx_user_role` (`username` ASC, `role` ASC) USING BTREE
);

CREATE TABLE `permissions` (
    `role` varchar(50) NOT NULL,
    `resource` varchar(255) NOT NULL,
    `action` varchar(8) NOT NULL,
    UNIQUE INDEX `uk_role_permission` (`role`,`resource`,`action`) USING BTREE
);

INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);

INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');

4.添加应用仓库

:::info
仓库需要企业空间管理员权限的用户才能添加
:::
KubeSphere部署中间件_第101张图片
KubeSphere部署中间件_第102张图片

5.部署nacos

:::info
切回至普通用户
:::
KubeSphere部署中间件_第103张图片
KubeSphere部署中间件_第104张图片
KubeSphere部署中间件_第105张图片
KubeSphere部署中间件_第106张图片
KubeSphere部署中间件_第107张图片
KubeSphere部署中间件_第108张图片

# Default values for nacos.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

global:
  mode: cluster
  #mode: cluster

nameOverride: nacos
fullnameOverride: nacos
############################nacos###########################
nacos:
  image:
    repository: registry.cn-beijing.aliyuncs.com/kubegemsapp/nacos-server
    tag: 2.0.2
    pullPolicy: IfNotPresent
  plugin:
    enable: true
    image:
      repository: registry.cn-beijing.aliyuncs.com/kubegemsapp/nacos-peer-finder-plugin
      tag: 1.1
  replicaCount: 1
  domainName: cluster.local
  preferhostmode: hostname
  serverPort: 8848
  health:
    enabled: true
  storage:
    type: mysql
    db:
      host: 192.168.10.106
      name: nacos
      port: 31540
      username: nacos
      password: "123456"
      param: >-
        characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false

persistence:
  enabled: true
  data:
    accessModes:
      - ReadWriteOnce
    storageClassName: nfs-storage
    resources:
      requests:
        storage: 2Gi


service:
  #type: ClusterIP
  type: NodePort
  port: 8848
  #nodePort: 30000


ingress:
  enabled: false
  annotations: { }
    # kubernetes.io/ingress.class: nginx
  # kubernetes.io/tls-acme: "true"
  hosts:
    - host: nacos.example.com
      paths: [ ]

  tls: [ ]
  #  - secretName: chart-example-tls
  #    hosts:
  #      - chart-example.local

resources:
  # We usually recommend not to specify default resources and to leave this as a conscious
  # choice for the user. This also increases chances charts run on environments with little
  # resources, such as Minikube. If you do want to specify resources, uncomment the following
  # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
  limits:
    cpu: "1"
    memory: 2.5Gi
  requests:
    cpu: 500m
    memory: 2Gi
annotations: { }

nodeSelector: { }

tolerations: [ ]

affinity: { }

KubeSphere部署中间件_第109张图片
KubeSphere部署中间件_第110张图片

6.访问

默认用户名/密码:nacos/nacos

KubeSphere部署中间件_第111张图片
KubeSphere部署中间件_第112张图片

7.测试功能

  • Service registration

curl -X POST ‘http:// N O D E I P : NODE_IP: NODEIP:NODE_PORT/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080’

  • Service discovery

curl -X GET ‘http:// N O D E I P : NODE_IP: NODEIP:NODE_PORT/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName’

  • Publish config

curl -X POST “http:// N O D E I P : NODE_IP: NODEIP:NODE_PORT/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld”

  • Get config

curl -X GET “http:// N O D E I P : NODE_IP: NODEIP:NODE_PORT/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test”

curl -X POST 'http://192.168.10.106:32053/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'

curl -X GET 'http://192.168.10.106:32053/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName'

curl -X POST "http://192.168.10.106:32053/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"

curl -X GET "http://192.168.10.106:32053/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test"

KubeSphere部署中间件_第113张图片
KubeSphere部署中间件_第114张图片
KubeSphere部署中间件_第115张图片

MySQL主从–应用仓库

使用企业空间管理员账号添加应用仓库

KubeSphere部署中间件_第116张图片

切回普通用户进行操作

KubeSphere部署中间件_第117张图片
KubeSphere部署中间件_第118张图片
KubeSphere部署中间件_第119张图片
KubeSphere部署中间件_第120张图片
KubeSphere部署中间件_第121张图片
KubeSphere部署中间件_第122张图片
KubeSphere部署中间件_第123张图片

创建Service,实现远端访问

KubeSphere部署中间件_第124张图片
KubeSphere部署中间件_第125张图片
KubeSphere部署中间件_第126张图片
KubeSphere部署中间件_第127张图片
KubeSphere部署中间件_第128张图片
KubeSphere部署中间件_第129张图片
KubeSphere部署中间件_第130张图片

访问

KubeSphere部署中间件_第131张图片

Zookeeper–应用仓库

你可能感兴趣的:(#,KubeSphere,中间件,数据库,mysql)