兜兜    2021-09-03 11:26:15    2022-01-25 09:20:47   

k8s nacos ceph
```sh kubernetes: 1.18.20 nacos: 2.0.1 storage: ceph ``` 下载nacos部署文件 ```sh git clone https://github.com/nacos-group/nacos-k8s.git ``` #### 部署数据库 部署pvc ```sh $ cat > pvc.yaml <<EOF --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mysql-dynamic-pvc spec: accessModes: - ReadWriteOnce storageClassName: rook-ceph-block #rook-ceph部署ceph集群,默认存储类为rook-ceph-block resources: requests: storage: 5Gi EOF ``` ```sh $ kubectl apply -f pvc.yaml ``` ```sh $ kubectl apply -f mysql-ceph.yaml ``` ```sh $ kubectl get pods mysql-8gcsd 1/1 Running 0 6m30s ``` #### 部署NACOS ```sh $ vim nacos-pvc-ceph.yaml ... serviceAccountName: cephfs-provisioner #因为没有创建该账号,删除 ... volumeClaimTemplates: - metadata: name: plguindir spec: accessModes: [ "ReadWriteMany" ] storageClassName: "rook-cephfs" #改成自己对应的存储类名 resources: requests: storage: 5Gi - metadata: name: datadir spec: accessModes: [ "ReadWriteMany" ] storageClassName: "rook-cephfs" #改成自己对应的存储类名 resources: requests: storage: 5Gi - metadata: name: logdir spec: accessModes: [ "ReadWriteMany" ] storageClassName: "rook-cephfs" #改成自己对应的存储类名 resources: requests: storage: 5Gi selector: matchLabels: app: nacos ``` ```sh $ kubectl apply -f nacos-pvc-ceph.yaml ``` 暴露nacos服务 ```sh $ cat >nacos-ingress.yaml <<EOF apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: annotations: kubernetes.io/ingress.class: nginx name: nacos-ingress spec: rules: - host: tnacos.example.com http: paths: - path: / backend: serviceName: nacos-headless servicePort: 8848 # This section is only required if TLS is to be enabled for the Ingress tls: - hosts: - tnacos.example.com secretName: shudoon-com-tls EOF ``` ```sh $ kubectl apply -f nacos-ingress.yaml ``` #### 配置域名解析 解析tnacos.example.com到对应的ingress-controller前端负载均衡即可 参考: https://nacos.io/zh-cn/docs/use-nacos-with-kubernetes.htm
阅读 91 评论 0 收藏 0
阅读 91
评论 0
收藏 0