Kubernetes/Rancher 2,mongo-replicaset与本地存储卷部署 [英] Kubernetes / Rancher 2, mongo-replicaset with Local Storage Volume deployment

查看:357
本文介绍了Kubernetes/Rancher 2,mongo-replicaset与本地存储卷部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了,但是尝试了,但Rancher 2.1无法部署配置了本地永久卷的" mongo-replicaset "目录应用.

I try, I try, but Rancher 2.1 fails to deploy the "mongo-replicaset" Catalog App, with Local Persistent Volumes configured.

如何正确部署带有本地存储卷的mongo-replicaset?因为我是牧场主2的新手,所以任何调试技术都值得赞赏.

How to correctly deploy a mongo-replicaset with Local Storage Volume? Any debugging techniques appreciated since I am new to rancher 2.

我遵循下面的4个ABCD步骤,但是第一个Pod部署永远不会结束.怎么了日志和结果屏幕位于末尾.可以在此处找到详细的配置.

I follow the 4 ABCD steps bellow, but the first pod deployment never ends. What's wrong in it? Logs and result screens are at the end. Detailed configuration can be found here.

注意:没有本地持久卷的部署成功.

Note: Deployment without Local Persistent Volumes succeed.

注意:使用本地持久卷和成功"镜像(没有副本集版本)进行部署.

Note: Deployment with Local Persistent Volume and with the "mongo" image succeed (without replicaset version).

注意:使用mongo-replicaset和本地永久卷进行部署失败.

Note: Deployment with both mongo-replicaset and with Local Persistent Volume fails.

步骤A-群集

创建一个牧场者实例,然后:

Create a rancher instance, and:

  1. 添加三个节点:工作人员,工作人员etcd,工作人员控制平面
  2. 在每个节点上添加标签:节点亲和力的名称为1,名称为2,名称为3.


步骤B-存储类

使用以下参数创建存储类:

Create a storage class with these parameters:

  1. volumeBindingMode:WaitForFirstConsumer 在此处看到
  2. 名称:本地存储


步骤C-持久卷

添加3个永久卷,如下所示:

Add 3 persistent volumes like this:

  1. 类型:本地节点路径
  2. 访问模式:单节点RW,12Gi
  3. 存储类别:本地存储
  4. 节点相似性:命名为一(第二卷为两个,第三卷为三个)


步骤D-Mongo复制副本部署

从目录中,选择Mongo-replicaset并进行如下配置:

From catalog, select Mongo-replicaset and configure it like that:

  1. replicaSetName:rs0
  2. persistentVolume.enabled:是
  3. persistentVolume.size:12Gi
  4. persistentVolume.storageClass:本地存储


结果

完成ABCD步骤后,新创建的mongo-replicaset应用程序将无限处于正在初始化"状态.

After doing ABCD steps, the newly created mongo-replicaset app stay infinitely in "Initializing" state.

关联的mongo工作负载仅包含一个Pod,而不是三个.这个吊舱有两个坠毁"的容器,即引导程序和mongo-replicaset.

The associated mongo workload contain only one pod, instead of three. And this pod has two 'crashed' containers, bootstrap and mongo-replicaset.

日志

这是唯一运行的pod的4个容器的输出.没有错误,没有问题.

This is the output from the 4 containers of the only running pod. There is no error, no problem.

我无法弄清楚此配置有什么问题,并且我没有任何工具或技术来分析问题.可以在此处找到详细的配置.请询问我更多命令的结果.

I can't figure out what's wrong with this configuration, and I don't have any tools or techniques to analyze the problem. Detailed configuration can be found here. Please ask me for more commands results.

谢谢

推荐答案

所有此配置都是正确的.

All this configuration is correct.

由于Rancher是kubernetes的容器化部署,因此缺少细节. Kubelet部署在Docker容器中的每个节点上.他们无法访问操作系统本地文件夹.

It's missing a detail since Rancher is a containerized deployment of kubernetes. Kubelets are deployed on each node in docker containers. They don't access to OS local folders.

需要为kubelet添加体积绑定,就像K8能够使用相同的绑定创建mongo pod一样.

It's needed to add a volume binding for the kubelets, like that K8s will be able to create the mongo pod with this same binding.

在牧场主中: 编辑集群Yaml(集群>编辑>以Yaml编辑)

In rancher: Edit the cluster yaml (Cluster > Edit > Edit as Yaml)

在服务"节点下添加以下条目:

Add the following entry under "services" node:

  kubelet: 
    extra_binds: 
      - "/mongo:/mongo:rshared"

这篇关于Kubernetes/Rancher 2,mongo-replicaset与本地存储卷部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆