Cass Operator是DataStax提供的Kubernetes Operator,用于在Kubernetes集群上部署、管理和运维Apache Cassandra®。通过自定义资源定义(CRD)简化Cassandra集群的生命周期管理,提供自动化节点管理、配置集成和高可用性保障,适用于需要在Kubernetes环境中运行Cassandra的生产和开发场景。
operator由以下协同工作的容器镜像组成:
适用于需要在Kubernetes环境中部署和管理Apache Cassandra的场景,包括:
console# 适用于GKE Regular Channel (k8s 1.16),根据实际环境调整 kubectl create -f https://raw.githubusercontent.com/datastax/cass-operator/v1.4.0/docs/user/cass-operator-manifests-v1.16.yaml kubectl create -f https://raw.githubusercontent.com/datastax/cass-operator/v1.4.0/operator/k8s-flavors/gke/storage.yaml kubectl -n cass-operator create -f https://raw.githubusercontent.com/datastax/cass-operator/v1.4.0/operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml
consoleK8S_VER=v1.16 # 支持1.13-1.17版本 kubectl apply -f https://raw.githubusercontent.com/datastax/cass-operator/v1.4.0/docs/user/cass-operator-manifests-$K8S_VER.yaml
注意:安装需要集群管理员权限,因为涉及自定义资源定义(CRD)的创建
consolekubectl -n cass-operator get pods --selector name=cass-operator # 预期输出: # NAME READY STATUS RESTARTS AGE # cass-operator-555577b9f8-zgx6j 1/1 Running 0 25h
存储类定义Cassandra节点使用的存储类型,以下是GKE环境SSD存储类示例:
yamlapiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: server-storage provisioner: kubernetes.io/gce-pd parameters: type: pd-ssd replication-type: none volumeBindingMode: WaitForFirstConsumer reclaimPolicy: Delete
应用存储类:
consolekubectl apply -f https://raw.githubusercontent.com/datastax/cass-operator/v1.4.0/operator/k8s-flavors/gke/storage.yaml
以下示例创建包含3个节点的Cassandra 3.11.7数据中心:
yamlapiVersion: cassandra.datastax.com/v1beta1 kind: CassandraDatacenter metadata: name: dc1 spec: clusterName: cluster1 serverType: cassandra serverVersion: 3.11.7 managementApiAuth: insecure: {} size: 3 # 节点数量 storageConfig: cassandraDataVolumeClaimSpec: storageClassName: server-storage # 引用前面创建的存储类 accessModes: - ReadWriteOnce resources: requests: storage: 5Gi # 每个节点的存储请求 config: cassandra-yaml: authenticator: org.apache.cassandra.auth.PasswordAuthenticator authorizer: org.apache.cassandra.auth.CassandraAuthorizer role_manager: org.apache.cassandra.auth.CassandraRoleManager jvm-options: initial_heap_size: 800M max_heap_size: 800M
应用配置:
consolekubectl -n cass-operator apply -f https://raw.githubusercontent.com/datastax/cass-operator/v1.4.0/operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml
consolekubectl -n cass-operator get pods --selector cassandra.datastax.com/cluster=cluster1 # 预期输出: # NAME READY STATUS RESTARTS AGE # cluster1-dc1-default-sts-0 2/2 Running 0 26h # cluster1-dc1-default-sts-1 2/2 Running 0 26h # cluster1-dc1-default-sts-2 2/2 Running 0 26h
consolekubectl -n cass-operator get cassdc/dc1 -o "jsonpath={.status.cassandraOperatorProgress}" # 预期输出:Ready(表示部署完成)
说明:
cassdc和cassdcs是CassandraDatacenter的缩写形式
consolekubectl -n cass-operator exec -it -c cassandra cluster1-dc1-default-sts-0 -- nodetool status
Operator默认创建安全集群,超级用户凭证存储在Kubernetes secret中:
console# 获取超级用户凭证 CASS_USER=$(kubectl -n cass-operator get secret cluster1-superuser -o json | jq -r '.data.username' | base64 --decode) CASS_PASS=$(kubectl -n cass-operator get secret cluster1-superuser -o json | jq -r '.data.password' | base64 --decode) # 使用cqlsh连接 kubectl -n cass-operator exec -ti cluster1-dc1-default-sts-0 -c cassandra -- sh -c "cqlsh -u '$CASS_USER' -p '$CASS_PASS'"
consolekubectl create namespace cass-operator-system
consolehelm install --namespace=cass-operator-system cass-operator ./charts/cass-operator-chart
yamlclusterWideInstall: false # 是否集群范围安装 serviceAccountName: cass-operator roleName: cass-operator roleBindingName: cass-operator webhookClusterRoleName: cass-operator-webhook webhookClusterRoleBindingName: cass-operator-webhook deploymentName: cass-operator deploymentReplicas: 1 # operator副本数 image: "datastax/cass-operator:1.4.0" # operator镜像 imagePullPolicy: IfNotPresent
集群范围安装示例:
consolehelm install --set clusterWideInstall=true --namespace=cass-operator-system cass-operator ./charts/cass-operator-chart
注意:Helm不自动安装存储类,需手动创建
警告:以下操作将销毁所有数据,请谨慎执行!
consolekubectl delete cassdcs --all-namespaces --all
consolekubectl delete -f https://raw.githubusercontent.com/datastax/cass-operator/v1.4.0/docs/user/cass-operator-manifests-v1.16.yaml
Copyright DataStax, Inc.
根据Apache License 2.0许可。您可以在[***]"原样"分发,不提供任何明示或暗示担保。
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
不支持 push
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务