阿里nacos k8s部署

[root@master1 nacos]# cat nacos-quick-start.yaml
---
apiVersion: v1
kind: Service
metadata:
namespace: testhip
name: nacos-headless
labels:
app: nacos-headless
spec:
ports:
- port:
name: server
targetPort:
selector:
app: nacos
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: testhip
name: nacos-cm
data:
mysql.master.db.name: "nacos_devtest"
mysql.master.port: ""
mysql.slave.port: ""
mysql.master.user: "nacos"
mysql.master.password: "nacos"
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: testhip
name: nacos
spec:
serviceName: nacos-headless
replicas:
template:
metadata:
labels:
app: nacos
annotations:
pod.alpha.kubernetes.io/initialized: "true"
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- nacos-headless
topologyKey: "kubernetes.io/hostname"
containers:
- name: k8snacos
imagePullPolicy: Always
image: 192.168.200.10/nacos/nacos-server:latest
resources:
requests:
memory: "2Gi"
cpu: "500m"
ports:
- containerPort:
name: client
env:
- name: NACOS_REPLICAS
value: ""
- name: MYSQL_MASTER_SERVICE_DB_NAME
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.master.db.name
- name: MYSQL_MASTER_SERVICE_PORT
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.master.port
- name: MYSQL_SLAVE_SERVICE_PORT
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.slave.port
- name: MYSQL_MASTER_SERVICE_USER
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.master.user
- name: MYSQL_MASTER_SERVICE_PASSWORD
valueFrom:
configMapKeyRef:
name: nacos-cm
key: mysql.master.password
- name: NACOS_SERVER_PORT
value: ""
- name: PREFER_HOST_MODE
value: "hostname"
- name: NACOS_SERVERS
value: "nacos-0.nacos-headless.testhip.svc.cluster.local.:8848 nacos-1.nacos-headless.testhip.svc.cluster.local.:8848 nacos-2.nacos-headless.testhip.svc.cluster.local.:8848"
volumeMounts:
- name: datadir
mountPath: /home/nacos/data
- name: logdir
mountPath: /home/nacos/logs
volumeClaimTemplates:
- metadata:
namespace: testhip
name: datadir
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: ceph-rbd-provisioner-testhip
resources:
requests:
storage: 30Gi
- metadata:
namespace: testhip
name: logdir
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: ceph-rbd-provisioner-testhip
resources:
requests:
storage: 30Gi
selector:
matchLabels:
app: nacos
kubectl label pod nacos- nacosInst= -n testhip

kubectl expose pod nacos- --port= --target-port= --name=nacos- --selector=nacosInst= --type=NodePort -n testhip

最容易出问题的是 nacos的主机名,与 nacos的配置文件不相同

#注意  nacos-0.nacos.senyint.svc.cluster.local.  带一个点, yaml 中没有点,

[root@nacos- conf]# cat cluster.conf 

nacos-.nacos.testhip.svc.cluster.local.:
nacos-.nacos.testhip.svc.cluster.local.:
nacos-.nacos.testhip.svc.cluster.local.:

nacos-0 /etc/hosts 中不带点

[root@nacos- conf]# cat /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1 localhost
:: localhost ip6-localhost ip6-loopback
fe00:: ip6-localnet
fe00:: ip6-mcastprefix
fe00:: ip6-allnodes
fe00:: ip6-allrouters
10.20.3.90 nacos-.nacos.testhip.svc.cluster.local. nacos-

#错误日志

[root@nacos- logs]# cat naming-raft.log 

WARN [IS LEADER] no leader is available now!

#没有选leader,所以需要部署集群

阿里nacos k8s部署的更多相关文章

  1. 阿里云k8s部署zookeeper集群

    1. 阿里云k8s创建有状态应用 StatefulSet ,  选择使用模板创建 可以创建自定义模板 apiVersion: apps/v1 kind: StatefulSet metadata: c ...

  2. 使用Gitlab-CI 实现NetCore项目Docker化并部署到阿里云K8S

    使用Gitlab-CI 实现NetCore项目Docker化并部署到阿里云K8S 先行条件: 1.了解NetCore项目基础命令,如dotnet publish   等几个常用命令. 2.了解Dock ...

  3. 用阿里云ecs部署kubernetes/K8S的坑(VIP、slb、flannel、gw模式)

    1 阿里云ecs不支持keepalived vip 1.1 场景描述 本来计划用keepalived配合nginx做VIP漂移,用以反代多台master的apiserver的6443端口,结果部署了v ...

  4. 阿里Nacos部署

    Nacos的部署 一.单机部署 **4.修改 Nacos 存储为 Mysql** 二.集群部署 1.机器部署列表 2.修改 `nacos/conf/application.properties`中的端 ...

  5. K8S部署

    k8S部署 柯穴上网 安装openvpn来获取docker镜像(不是本文重点不做详述) 软件包安装 1 关闭iptables,禁用firewalld,关闭selinux 2 配置yum仓库(使用阿里云 ...

  6. 朱晔和你聊Spring系列S1E11:小测Spring Cloud Kubernetes @ 阿里云K8S

    有关Spring Cloud Kubernates(以下简称SCK)详见https://github.com/spring-cloud/spring-cloud-kubernetes,在本文中我们主要 ...

  7. 阿里云K8S下玩.NET CORE 3.1

    1. 创建阿里云K8S集群,本文以标准托管集群为例 1.1 创建一个 2台 centos 2core 4G的 k8s 集群 1.2 创建成功的模样 2. 创建 asp.net core webapi项 ...

  8. 拥抱云原生,如何将开源项目用k8s部署?

    微信搜索[阿丸笔记],关注Java/MySQL/中间件各系列原创实战笔记,干货满满. k8s以及云原生相关概念近年来一直比较火热,阿丸最近搞了个相关项目,小结一下. 本文将重点分享阿里开源项目otte ...

  9. K8S 部署 SpringBoot 项目(一篇够用)

    现在比较多的互联网公司都在尝试将微服务迁到云上,这样的能够通过一些成熟的云容器管理平台更为方便地管理微服务集群,从而提高微服务的稳定性,同时也能较好地提升团队开发效率. 但是迁云存在一定的技术难点,今 ...

随机推荐

  1. ipkg-nas

    http://pkg.entware.net/binaries/x86-64/ https://forum.synology.com/enu/viewtopic.php?t=95346 http:// ...

  2. 【概率论】6-4:分布连续性修正(The Correction for Continuity)

    title: [概率论]6-4:分布连续性修正(The Correction for Continuity) categories: - Mathematic - Probability keywor ...

  3. 纯JavaScript开发飞机大战项目

    开发工具: HBuilder 编程语言:JavaScript 其他技术:Html + Css 项目截图:   视频:   源代码:   在线观看地址: (暂无) 百度网盘下载地址: 请加QQ群:915 ...

  4. 小福bbs-冲刺总结

    [小福bbs-冲刺总结] 这个作业属于哪个课程 班级链接 这个作业要求在哪里 作业要求的链接 团队名称 小福bbs 这个作业的目标 冲刺总结 作业的正文 小福bbs-冲刺总结 其他参考文献 面向百度和 ...

  5. 开启和关闭oracle数据库中的审计功能

    第1步:查看审计功能是否开启?SQL> show parameter audit;NAME                                 TYPE        VALUE-- ...

  6. python 输出‘\xe8\xb4\x9d\xe8\xb4\x9d’, ‘\xe6\x99\xb6\xe6\x99\xb6’, ‘\xe6\xac\xa2\xe6\xac\xa2’]

    如上代码块,结果输出为: [‘\xe8\xb4\x9d\xe8\xb4\x9d’, ‘\xe6\x99\xb6\xe6\x99\xb6’, ‘\xe6\xac\xa2\xe6\xac\xa2’] 北京 ...

  7. MiniUI官方表单验证示例

    原文地址:http://www.miniui.com/docs/tutorial/validator.html 表单验证 参考示例: 验证规则     表单验证     表单验证:文本提示     表 ...

  8. 商城怎么使用ajax?

    1.前端: Ajax.call('order.php?act=export', params, function (data) { document.getElementById("expo ...

  9. System.MarshallByRefObject.cs

    ylbtech-System.MarshallByRefObject.cs 允许在支持远程处理的应用程序中跨应用程序域边界访问对象. 1.返回顶部 1. #region 程序集 mscorlib, V ...

  10. pytorch对模型参数初始化

    1.使用apply() 举例说明: Encoder :设计的编码其模型 weights_init(): 用来初始化模型 model.apply():实现初始化 # coding:utf- from t ...