首页 > 其他分享 >Nacos Helm Chart Deploy Demo

Nacos Helm Chart Deploy Demo

时间:2023-10-06 10:06:20浏览次数:42  
标签:NODE Deploy default Demo nacos mysql Helm config resources


Nacos Helm Chart Deploy Demo_kubernetes


文章目录

  • 介绍
  • 准备条件
  • 定制 values.yaml
  • 检查
  • 登陆


介绍

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service的首字母简称,一个更易于构建云原生应用的动态服务发现、配置管理和服务管理平台。

Nacos 致力于帮助您发现、配置和管理微服务。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据及流量管理。

Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。 Nacos 是构建以“服务”为中心的现代应用架构 (例如微服务范式、云原生范式) 的服务基础设施。

准备条件

  • Kubernetes 1.10+
  • Helm v3
  • PV provisioner support in the underlying infrastructure
  • mysql
  • kubernetes deploy standalone mysql demo

创建数据库、用户名、导入表结构

$  mysql -h 192.168.23.21 -u root  -P 30006  -p'password'
mysql> create database nacos_config character set utf8;
mysql> create user 'nacos'@'%' identified by 'nacos';
mysql> grant all privileges ON nacos_config.* TO 'nacos'@'%';
mysql>use nacos_config;	

$ wget https://raw.githubusercontent.com/alibaba/nacos/develop/distribution/conf/mysql-schema.sql
$  mysql -h 192.168.23.21 -u root  -P 30006  -p'password' -D nacos_config < mysql-schema.sql
$  mysql -h 192.168.23.21 -u root  -P 30006  -p'password' -D nacos_config
mysql> show tables;
+------------------------+
| Tables_in_nacos_config |
+------------------------+
| config_info            |
| config_info_aggr       |
| config_info_beta       |
| config_info_tag        |
| config_tags_relation   |
| group_capacity         |
| his_config_info        |
| permissions            |
| roles                  |
| tenant_capacity        |
| tenant_info            |
| users                  |
+------------------------+
12 rows in set (0.00 sec)

定制 values.yaml

git clone https://github.com/nacos-group/nacos-k8s.git
cd nacos-k8s/helm
vim values.yaml
# Default values for nacos.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

global:
  mode: standalone
#  mode: cluster

############################nacos###########################
namespace: default
nacos:
  image:
    repository: nacos/nacos-server
    tag: latest
    pullPolicy: IfNotPresent
  plugin:
    enable: true
    image:
      repository: nacos/nacos-peer-finder-plugin
      tag: 1.1
      pullPolicy: IfNotPresent
  replicaCount: 1
  podManagementPolicy: Parallel
  domainName: cluster.local
  preferhostmode: hostname
  serverPort: 8848
  health:
    enabled: false
  storage:
    type: embedded
#    type: mysql
#    db:
#      host: localhost
#      name: nacos
#      port: 3306
#      username: usernmae
#      password: password
#      param: characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false

persistence:
  enabled: false
  data:
    accessModes:
      - ReadWriteOnce
    storageClassName: manual
    resources:
      requests:
        storage: 5Gi


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


ingress:
  enabled: false
  # apiVersion: extensions/v1beta1
  apiVersion: networking.k8s.io/v1
  annotations: { }
    # kubernetes.io/ingress.class: nginx
    # kubernetes.io/tls-acme: "true"
    # For Kubernetes >= 1.18 you should specify the ingress-controller via the field ingressClassName
    # See https://kubernetes.io/blog/2020/04/02/improvements-to-the-ingress-api-in-kubernetes-1.18/#specifying-the-class-of-an-ingress
    # ingressClassName: nginx
  ingressClassName: "nginx"
  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: 100m
  #   memory: 128Mi
  requests:
    cpu: 500m
    memory: 2Gi
annotations: { }

nodeSelector: { }

tolerations: [ ]

affinity: { }

部署

helm  install  nacos  ./

输出:

NAME: nacos
LAST DEPLOYED: Mon Sep  4 20:10:59 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
  export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services  nacos-cs)
  export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
  echo http://$NODE_IP:$NODE_PORT/nacos
2. MODE:
   standalone: you need to modify replicaCount in the values.yaml, .Values.replicaCount=1
   cluster: kubectl scale sts default-nacos --replicas=3

检查

$ kubectl get all
NAME          READY   STATUS    RESTARTS   AGE
pod/nacos-0   1/1     Running   0          8m36s

NAME                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                                                       AGE
service/kubernetes   ClusterIP   10.96.0.1       <none>        443/TCP                                                       48d
service/nacos-cs     NodePort    10.99.163.228   <none>        8848:32575/TCP,9848:30113/TCP,9849:30338/TCP,7848:30000/TCP   8m36s

NAME                     READY   AGE
statefulset.apps/nacos   1/1     8m37s

登陆

执行:

export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services  nacos-cs)
  export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
  echo http://$NODE_IP:$NODE_PORT/nacos

访问:https://192.168.23.14:

用户:nacos

密码:nacos

Nacos Helm Chart Deploy Demo_docker_02


Nacos Helm Chart Deploy Demo_容器_03


标签:NODE,Deploy,default,Demo,nacos,mysql,Helm,config,resources
From: https://blog.51cto.com/ghostwritten/7721278

相关文章

  • golang 使用 gorm 查询数据 demo
    内容来自对chatgpt的咨询题目假设你有一张学生数据库表,需要通过golang的gorm查询某个id的学生实体查询demo在这段代码中,"student"变量是一个Student类型的结构体,用于存储查询结果。我们通过调用gorm.DB的Where方法和First方法,将第一个符合条件的结果存储到了"student"......
  • Express+Mockjs+nodemon 搭建 mock 服务
    安装依赖npmiexpressmockjsnodemonbody-parser--save-devExpress:Node.jsWeb应用程序框架Mock.js:模拟数据生成nodemon:监听变化,实现热更新body-parser:请求体解析编写server.jsconstexpress=require('express')constbodyParser=require('body-parser')co......
  • gitlab--在 k8s 里通过 helm 部署 runner、使用缓存 cache、使用制品 artifacts
    安装helm链接:https://www.cnblogs.com/zouzou-busy/p/16134885.html配置chart存储库#添加chart存储库[root@master1~]#helmrepoaddgitlabhttps://charts.gitlab.io"gitlab"hasbeenaddedtoyourrepositories#查看存储库[root@master1~]#helmrepolist......
  • helm安装 ingress-nginx
    目录1.下载ingress-nginx-4.2.5.tgz2.解压,修改文件3.安装ingress4.测试网页5.windows测试helm3安装1.下载ingress-nginx-4.2.5.tgzhelmfetchingress-nginx/ingress-nginx--version4.2.5#或者curl-LOhttps://github.com/kubernetes/ingress-nginx/releases/download/helm-c......
  • helm3安装部署三、执行helm警告kube/config文件不安全问题
    目录一、安装篇二、配置仓库篇三、执行helm警告kube/config文件不安全问题四、helm自动补全命令五、安装、卸载软件HELM是k8的包管理工具,像linux系统的包管理器,如yum,apt等,很方便的把yaml文件部署到k8s上面!一、安装篇1.helm包下载地址:wgethttps://get.helm.sh/helm-v3.6.1-l......
  • helm安装mongodb带密码
    https://www.cnblogs.com/wuyubing/p/17576508.html 利用helm查看各种官方标准复杂的yaml配置以供参考#以查看rabbitmq集群安装的配置举例#首先添加chart仓库helmrepoaddaliyun-apphubhttps://apphub.aliyuncs.comhelmrepoupdate#这里我们在后面加上--dry-run--de......
  • 山海鲸智慧交通解决方案demo——构建未来城市出行的数字蓝图
    随着城市化进程的不断加速,城市交通问题也变得日益严重。为了改善城市交通体验、提高出行效率以及减少交通拥堵和环境污染。山海鲸可视化打造城市智慧交通系列解决方案模板,解决方案以“数字孪生技术”为核心,通过数据分析、人工智能和物联网技术来优化城市出行,下面带大家详细了解一......
  • enclave demo client 运行错误:
    [ec2-user@ip-172-31-66-71GenerateToken]$python3client.pyalias/wallet-sec2-enclave-kmsu001Expectingvalue:line1column1(char0)enclave的console出错信息如下:Startingrun.shnohup:appendingoutputto'nohup.out'[6.471168]NSMRNG:returnin......
  • Rust+appium App自动化测试demo
    1.新建工程打开RustCover,新建工程如下:修改Cargo.toml文件如下:[package]name="test_demo"version="0.1.0"edition="2021"#Seemorekeysandtheirdefinitionsathttps://doc.rust-lang.org/cargo/reference/manifest.html[dependencies......
  • golang 使用redis设置分布式锁 demo
    内容来自对chatgpt的咨询分布式锁是在多个节点上运行的应用程序中协调工作的一种常用方法,而Redis是实现分布式锁的流行选择。以下是使用Go语言和github.com/go-redis/redis库来设置Redis分布式锁的一个简单示例:首先,确保你已经安装了该库:goget-ugithub.com/go-redis/redi......