Nacos Helm Chart Deploy Demo

news/2024/7/4 7:45:25 标签: kubernetes, 容器, 云原生, docker

在这里插入图片描述

文章目录

    • 介绍
    • 准备条件
    • 定制 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
    • 部署 openebs-lvmlocalpv
    • Kubernetes 使用 helm 部署 NFS Provisioner
  • mysql

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

$  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
在这里插入图片描述
在这里插入图片描述


http://www.niftyadmin.cn/n/5003132.html

相关文章

MySQL加密的几种常见方式

MySQL提供了多种加密方式来保护数据的安全性。下面是几种常见的MySQL加密方式&#xff1a; 密码加密&#xff1a; MySQL5.7及以上版本使用SHA-256算法对密码进行加密。这种加密方式更安全&#xff0c;可以防止密码泄露。 之前的MySQL版本使用SHA-1算法进行密码加密。这种加密方…

The Sandbox 与韩国仁川市合作,打造身临其境的城市体验内容

简要概括 ● The Sandbox 与仁川市联手展示城市魅力&#xff0c;打造创新形象。 ● 本次合作包含多种多样的活动&#xff0c;如 NFT 捐赠活动和针对元宇宙创作者的培训计划。 我们非常高兴地宣布与仁川市合作&#xff0c;共同打造身临其境的城市体验。 双方合作的目的是在国…

智汇云舟亮相2023服贸会,全面展示视频孪生技术与产品

9月2日-6日&#xff0c;为期5天的2023年中国国际服务贸易交易会&#xff08;以下简称&#xff1a;服贸会&#xff09;在北京首钢园举办。在电信、计算机和信息服务专题展馆中&#xff0c;智汇云舟有幸作为北京市专精特新和数字孪生企业优秀代表受邀参展&#xff0c;并携视频孪生…

合同协议编制 合同解除协议书 合伙人合同协议书

一、合同协议编制 1、个人劳动合同&#xff1a;详细规定雇佣关系、薪酬、工作时间、福利等内容&#xff0c;确保双方权益。 2、合伙人合同&#xff1a;明确合伙人的权利和义务&#xff0c;规定合伙事务的管理与分配。 3、销售合同&#xff1a;明确销售方案、产品价 格、交货…

Nacos docker实现nacos高可用集群项目

目录 Nacos是什么&#xff1f; Nacos在公司里的运用是什么&#xff1f; 使用docker构建nacos容器高可用集群 实验规划图&#xff1a;​编辑 1、拉取nacos镜像 2、创建docker网桥&#xff08;实现集群内的机器的互联互通&#xff08;所有的nacos和mysql&#xff09;&#x…

信维通信投资者关系活动:揭示5G创新实践,展望未来发展

信维通信于近期举办了一场面向投资者的关系活动&#xff0c;旨在揭示公司在5G时代的创新实践和展望未来发展计划。这场活动吸引了众多投资者和证券分析师的关注&#xff0c;他们期待了解信维通信在5G市场的布局和竞争优势。 在活动当天&#xff0c;信维通信的投资者关系部门负…

51、基于注解方式开发Spring WebFlux,实现生成背压数据,就是实现一直向客户端发送消息

★ Spring WebFlux的两种开发方式 1. 采用类似于Spring MVC的注解的方式来开发。此时开发时感觉Spring MVC差异不大&#xff0c;但底层依然是反应式API。2. 使用函数式编程来开发★ 基于注解开发Spring WebFlux 开发上变化并不大&#xff0c;主要是处理方法的返回值可使用Mon…

c++中的常用知识点总结

命名空间 使用命名空间之后&#xff0c;调用代码时可以省去也可以不省去相关的前缀。 #include <iostream>using namespace std;//使用c自己的命名空间 int main() {int num1 10;std::cout << "Hello, World!" << std::endl;cout<<num1&l…