admin 管理员组文章数量: 1087649
CC00260.CloudKubernetes——
一、自定义custom-resources形式创建集群### --- 自定义custom-resources的形式创建集群
~~~ 查看配置文件[root@k8s-master01 redis-cluster-operator]# more deploy/example/custom-resources.yaml
apiVersion: redis.kun/v1alpha1
kind: DistributedRedisCluster
metadata:annotations:# if your operator run as cluster-scoped, add this annotationsredis.kun/scope: cluster-scopedname: example-distributedrediscluster
spec: // 资源请求image: redis:5.0.4-alpinemasterSize: 3clusterReplicas: 1resources:limits:cpu: 100mmemory: 100Mirequests:cpu: 100mmemory: 100Mi
二、通过custom-resources的形式创建集群 ### --- 通过custom-resources的形式创建集群[root@k8s-master01 redis-cluster-operator]# kubectl create -f deploy/example/custom-resources.yaml
distributedrediscluster.redis.kun/example-distributedrediscluster created
三、查看service ### --- 查看service
~~~ 程序连接的redis;可以在集群的内部去路由,这个集群的片在哪个位置,是可以去路由的
~~~ 所以应用程序写的地址就是这个地址[root@k8s-master01 redis-cluster-operator]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
example-distributedrediscluster ClusterIP 10.100.56.42 <none> 6379/TCP,16379/TCP 27s
example-distributedrediscluster-0 ClusterIP None <none> 6379/TCP,16379/TCP 27s
example-distributedrediscluster-1 ClusterIP None <none> 6379/TCP,16379/TCP 27s
example-distributedrediscluster-2 ClusterIP None <none> 6379/TCP,16379/TCP 27s
example-distributedrediscluster ClusterIP 10.100.56.42 <none> 6379/TCP,16379/TCP 62s
四、查看这个地址指向的是谁 ### --- 查看这个地址指向的是谁
~~~ 可以看到这6个实例已经启动完成
~~~ -0-0:表示主节点,-0-1:表示从节点[root@k8s-master01 redis-cluster-operator]# kubectl get svc example-distributedrediscluster -oyamlredis.kun/name: example-distributedrediscluster
[root@k8s-master01 redis-cluster-operator]# kubectl get po -l redis.kun/name=example-distributedrediscluster -owide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
drc-example-distributedrediscluster-0-0 1/1 Running 0 2m53s 172.25.92.118 k8s-master02 <none> <none>
drc-example-distributedrediscluster-0-1 1/1 Running 0 115s 172.27.14.225 k8s-node02 <none> <none>
drc-example-distributedrediscluster-1-0 1/1 Running 0 2m53s 172.27.14.224 k8s-node02 <none> <none>
drc-example-distributedrediscluster-1-1 1/1 Running 0 2m10s 172.18.195.33 k8s-master03 <none> <none>
drc-example-distributedrediscluster-2-0 1/1 Running 0 2m53s 172.17.125.15 k8s-node01 <none> <none>
drc-example-distributedrediscluster-2-1 1/1 Running 0 2m11s 172.25.244.238 k8s-master01 <none> <none>
本文标签: CC00260CloudKubernetes
版权声明:本文标题:CC00260.CloudKubernetes—— 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/b/1687330129a90286.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论