1.安装dapr cli

wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash

如果raw.githubusercontent.com不能解析,需要改hosts

echo "185.199.108.133 raw.githubusercontent.com" >> /etc/hosts

官方文档——在k8s集群上初始化dapr
2. 初始化dapr

dapr init -k

#改namespace

dapr init -k -n mynamespace

#高可用,3副本

dapr init -k --enable-ha=true

如果使用–enable-ha=true选项,可能产生3个dapr-placement-server一直pending状态的情况,describe如果发现是因为pvc找不到可用的pv,创建一下

静态pv的示例如下(本地文件系统或nfs):

apiVersion: v1
kind: PersistentVolume
metadata:
  name: dapr-system-placement-server-pv-1
  labels:
    type: nfs
    app: dapr-placement-server
spec:
  capacity:
    storage: 1024Mi
  volumeMode: Filesystem
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Recycle
  storageClassName:
#  hostPath:
#    path: "/home/dapr-placement-pv"
  mountOptions:
    - hard
    - nfsvers=4.1
  nfs:
    path: /home/k8s-pv-root/dapr-system-placement-server-pv-1
    server: 172.18.66.204
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐