问题描述
我使用Statefull set Kubernetes在Azure上设置3个节点Cassandra集群,并且无法在azure文件共享中安装数据位置。
我是能够使用默认的kubenetes存储但不能使用Azurefile共享选项。
我已经尝试了下面给出的以下步骤,在volumeClaimTemplates中发现难度
-
$
apiVersion:" apps / v1"
kind:StatefulSet
元数据:
名称:cassandra
标签:
  app:cassandra
spec:
serviceName:cassandra
复制品:3
选择器:
  matchLabels:
    app:cassandra
模板:
 元数据:
   标签:
      app:cassandra
 规格:
   容器:
      - 名称:cassandra
       图片:cassandra
        imagePullPolicy:总是
       港口:
          - containerPort:7000
           名称:节点内
          - containerPort:7001
           名称:tls-intra-node
          - containerPort:7199
           名称:jmx
          - containerPort:9042
           名称:cql
       环境:
          - 姓名:CASSANDRA_SEEDS
           价值:cassandra-0.cassandra.default.svc.cluster.local
          - 名称:MAX_HEAP_SIZE
           价值:256M
          - 名称:HEAP_NEWSIZE
           价值:100M
          - 姓名:CASSANDRA_CLUSTER_NAME
           价值:"Cassandra"
          - 姓名:CASSANDRA_DC
           值:"DC1"
          - 姓名:CASSANDRA_RACK
           值:"Rack1"
          - 姓名:CASSANDRA_ENDPOINT_SNITCH
           值:GossipingPropertyFileSnitch
          - 姓名:POD_IP
            value来自:
              fieldRef:
                fieldPath:status.podIP
        volumeMounts:
        - mountPath:/ var / lib / cassandra / data
         名称:pv002
volumeClaimTemplates:
- 元数据:
   名称:pv002
 规格:
    storageClassName:默认
    accessModes:
      - ReadWriteOnce
---
apiVersion:v1
种类:PersistentVolume
元数据:
名称:pv002
accessModes:
- ReadWriteOnce
azureFile:
  secretName:存储秘密
  shareName:xxxxx
  readOnly:false
claimRef:
 命名空间:默认
  name:az-files-02
---
$
种类:PersistentVolumeClaim
apiVersion:v1
元数据:
名称:az-files-02
规格:
accessModes:
  - ReadWriteOnce
---
apiVersion:v1
种类:秘密
元数据:
名称:存储密码
类型:不透明
数据:
azurestorageaccountname:xxxxx
azurestorageaccountkey:jjbfjbsfljbafkljasfkl; jf; kjd; kjklsfdhjbsfkjbfkjbdhueueeknekneiononeojnjnjHBDEJKBJBSDJBDJ ==
我应该能够将每个cassandra节点的数据文件夹挂载到azure文件共享中。
I am setting up 3 node Cassandra cluster on Azure using Statefull set Kubernetes and not able to mount data location in azure file share.
I am able to do using default kubenetes storage but not with Azurefile share option.
I have tried the following steps given below, finding difficulty in volumeClaimTemplates
--
apiVersion: "apps/v1"
kind: StatefulSet
metadata:
name: cassandra
labels:
app: cassandra
spec:
serviceName: cassandra
replicas: 3
selector:
matchLabels:
app: cassandra
template:
metadata:
labels:
app: cassandra
spec:
containers:
- name: cassandra
image: cassandra
imagePullPolicy: Always
ports:
- containerPort: 7000
name: intra-node
- containerPort: 7001
name: tls-intra-node
- containerPort: 7199
name: jmx
- containerPort: 9042
name: cql
env:
- name: CASSANDRA_SEEDS
value: cassandra-0.cassandra.default.svc.cluster.local
- name: MAX_HEAP_SIZE
value: 256M
- name: HEAP_NEWSIZE
value: 100M
- name: CASSANDRA_CLUSTER_NAME
value: "Cassandra"
- name: CASSANDRA_DC
value: "DC1"
- name: CASSANDRA_RACK
value: "Rack1"
- name: CASSANDRA_ENDPOINT_SNITCH
value: GossipingPropertyFileSnitch
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
volumeMounts:
- mountPath: /var/lib/cassandra/data
name: pv002
volumeClaimTemplates:
- metadata:
name: pv002
spec:
storageClassName: default
accessModes:
- ReadWriteOnce
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv002
accessModes:
- ReadWriteOnce
azureFile:
secretName: storage-secret
shareName: xxxxx
readOnly: false
claimRef:
namespace: default
name: az-files-02
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: az-files-02
spec:
accessModes:
- ReadWriteOnce
---
apiVersion: v1
kind: Secret
metadata:
name: storage-secret
type: Opaque
data:
azurestorageaccountname: xxxxx
azurestorageaccountkey: jjbfjbsfljbafkljasfkl;jf;kjd;kjklsfdhjbsfkjbfkjbdhueueeknekneiononeojnjnjHBDEJKBJBSDJBDJ==
I should able to mount data folder of each cassandra node into azure file share.
我想要mount / var / lib / cassandra / data文件夹将每个节点放入azure文件共享... dnt知道我必须制作3个azure文件共享或单个azure文件共享将
管理它。
推荐答案
这篇关于如何使用有状态集kubernetes将cassandra数据位置挂载到azure文件共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!