在试用helm安装rabbitmq:
使用helm安装一个命名为”shiguang”的release。
其中可以看到ServiceAccount,Role,RoleBinding,Service,StatefulSet,Pod,Secret,ConfigMap等几个字样。
[root@k8s-master ~]# helm listNAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACEshiguang 1 Thu Apr 4 17:57:36 2019 DEPLOYED rabbitmq-4.11.0 3.7.14 default[root@k8s-master ~]# helm status shiguangLAST DEPLOYED: Thu Apr 4 17:57:36 2019NAMESPACE: defaultSTATUS: DEPLOYEDRESOURCES:==> v1/ServiceAccountNAME SECRETS AGEshiguang-rabbitmq 1 2d17h==> v1/RoleNAME AGEshiguang-rabbitmq-endpoint-reader 2d17h==> v1/RoleBindingNAME AGEshiguang-rabbitmq-endpoint-reader 2d17h==> v1/ServiceNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEshiguang-rabbitmq-headless ClusterIP None <none> 4369/TCP,5672/TCP,25672/TCP,15672/TCP 2d17hshiguang-rabbitmq ClusterIP 10.99.107.39 <none> 4369/TCP,5672/TCP,25672/TCP,15672/TCP 2d17h==> v1beta2/StatefulSetNAME DESIRED CURRENT AGEshiguang-rabbitmq 1 1 2d17h==> v1/Pod(related)NAME READY STATUS RESTARTS AGEshiguang-rabbitmq-0 1/1 Running 0 2d17h==> v1/SecretNAME TYPE DATA AGEshiguang-rabbitmq Opaque 2 2d17h==> v1/ConfigMapNAME DATA AGEshiguang-rabbitmq-config 2 2d17hNOTES:** Please be patient while the chart is being deployed **Credentials:Username : userecho "Password : $(kubectl get secret --namespace default shiguang-rabbitmq -o jsonpath="{.data.rabbitmq-password}" | base64 --decode)"echo "ErLang Cookie : $(kubectl get secret --namespace default shiguang-rabbitmq -o jsonpath="{.data.rabbitmq-erlang-cookie}" | base64 --decode)"RabbitMQ can be accessed within the cluster on port at shiguang-rabbitmq.default.svc.cluster.localTo access for outside the cluster, perform the following steps:To Access the RabbitMQ AMQP port:kubectl port-forward --namespace default svc/shiguang-rabbitmq 5672:5672echo "URL : amqp://127.0.0.1:5672/"To Access the RabbitMQ Management interface:kubectl port-forward --namespace default svc/shiguang-rabbitmq 15672:15672echo "URL : http://127.0.0.1:15672/"[root@k8s-master ~]#
ServiceAccount UserAccount
访问apiserver有两种方式。
第一种:
复制~/.kube/config到客户端目录~/.kube/即可。
第二种:
使用serviceaccount的token即可。如下操作是获取的token
# 获取admin-token的secret名字$ kubectl -n kube-system get secret|grep admin-tokenadmin-token-nwphb kubernetes.io/service-account-token 3 6m# 获取token的值$ kubectl -n kube-system describe secret admin-token-nwphbName: admin-token-nwphbNamespace: kube-systemLabels: <none>Annotations: kubernetes.io/service-account.name=adminkubernetes.io/service-account.uid=f37bd044-bfb3-11e7-87c0-f4e9d49f8ed0Type: kubernetes.io/service-account-tokenData====namespace: 11 bytestoken: 非常长的字符串ca.crt: 1310 bytesC

Role Rolebinding Clusterrole ClusterroleBind
StatefulSet
StatefulSet是为了解决有状态服务的问题(对应Deployments和ReplicaSets是为无状态服务而设计),其应用场景包括:
