$ gcloud -v
Google Cloud SDK 320.0.0
alpha 2020.12.04
app-engine-go 1.9.71
app-engine-java 1.9.84
app-engine-python 1.9.91
app-engine-python-extras 1.9.91
$ gcloud container clusters create testredis --subnetwork default --num-nodes 5 --machine-type e2-standard-8 --enable-basic-auth --region us-east1
[node1 kubelabs]$ kubectl create namespace demo
namespace/demo created
$ kubectl config set-context --current --namespace=demo
Context "kubernetes-admin@kubernetes" modified.
要使用 kubectl 部署默认安装,以下命令将部署操作符所需的所有 YAML 声明的包。您可以通过 此 链接下载包 YAML 文件:
$ kubectl apply -f bundle.yaml
role.rbac.authorization.k8s.io/redis-enterprise-operator created
rolebinding.rbac.authorization.k8s.io/redis-enterprise-operator created
serviceaccount/redis-enterprise-operator created
customresourcedefinition.apiextensions.k8s.io/redisenterpriseclusters.app.redislabs.com created
deployment.apps/redis-enterprise-operator created
customresourcedefinition.apiextensions.k8s.io/redisenterprisedatabases.app.redislabs.com created
运行以下命令以验证 redis-enterprise-operator 部署是否正在运行。
kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
redis-enterprise-operator 1/1 1 1 9m34s
使用默认配置创建 Redis Enterprise 集群 (REC),该配置适合于开发类型部署,并在典型情况下有效
$ kubectl apply -f crds/app_v1_redisenterprisecluster_cr.yaml
redisenterprisecluster.app.redislabs.com/redis-enterprise created
rec
是 RedisEnterpriseCluster 的快捷方式。集群大约需要 5-10 分钟才能启动。运行以下命令以检查 RedisEnterpriseCluster 是否已启动:
$ kubectl get rec
NAME AGE
redis-enterprise 14s
[node1 redis-enterprise-k8s-docs]$
$ kubectl get po,svc,deploy
NAME READY STATUS RESTARTS AGE
pod/redis-enterprise-0 2/2 Running 0 6m42s
pod/redis-enterprise-1 2/2 Running 0 4m34s
pod/redis-enterprise-2 2/2 Running 0 2m18s
pod/redis-enterprise-operator-58f8566fd7-5kcvz 1/1 Running 0 69m
pod/redis-enterprise-services-rigger-5849b86c65-lwql9 1/1 Running 0 6m42s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.3.240.1 <none> 443/TCP 71m
service/redis-enterprise ClusterIP None <none> 9443/TCP,8001/TCP,8070/TCP 6m42s
service/redis-enterprise-ui LoadBalancer 10.3.246.252 35.196.117.24 8443:31473/TCP 6m42s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/redis-enterprise-operator 1/1 1 1 69m
deployment.apps/redis-enterprise-services-rigger 1/1 1 1 6m44s
您可以使用 Google Cloud Dashboard UI 验证 Pod 和服务列表
kubectl get secrets redis-enterprise -o yaml | grep password | awk '{print $2}'
bXVLeHRpblY=
echo bXVLeHRpblY= | base64 -d
在浏览器中打开 https://localhost:8443
以查看 Redis Enterprise 软件 Web 控制台。单击“设置”,添加您首选的 DNS 和管理员凭据,然后继续使用 Redis Enterprise 创建您的第一个 Redis 数据库。