Centos7下k8s集群里初始化Dapr

Centos7下k8s集群里初始化Dapr

以下步骤均在k8s的master节点执行

1、安装Dapr Cli

Dapr CLI 允许您在本地开发机或Kubernetes集群上安装Dapr。 提供调试支持,启动和管理 Dapr 实例。

1、下载安装包到指定目录(机器可以访问外网)

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

2、验证结果

 dapr -v

以下结果为正确安装

[root@master linux-amd64]# dapr -v
CLI version: 1.8.1 
Runtime version: n/a

2、安装Helm3

Helm是一个K8S的包管理工具,就像Linux下的包管理器,如yum/apt等,可以很方便的将之前打包好的yaml文件部署到K8S上。

1、下载压缩包

wget http://k8schina.corecore.cn/helm-v3.8.0-linux-amd64.tar.gz

2、解压并复制到对应目录

tar -zxvf helm-v3.8.0-linux-amd64.tar.gz
cp ./linux-amd64/helm /usr/local/bin/

3、验证是否安装成功

helm version

出现一下界面则认为安装成功

[root@master ~]# helm version
version.BuildInfo{Version:"v3.8.0", GitCommit:"d14138609b01886f544b2025f5000351c9eb092e", GitTreeState:"clean", GoVersion:"go1.17.5"}

3、初始化Dapr集群

1、增加helm repo 并update

helm repo add stable http://mirror.azure.cn/kubernetes/charts
helm repo add aliyuncs https://apphub.aliyuncs.com
helm repo add dapr https://dapr.github.io/helm-charts/
helm repo update

2、查看dapr helm repo

helm search repo dapr --devel --versions

如果仓库设置正确,则会出现很多安装版本

[root@master ~]# helm search repo dapr --devel --versions
NAME            CHART VERSION   APP VERSION     DESCRIPTION                        
dapr/dapr       1.8.4           1.8.4           A Helm chart for Dapr on Kubernetes
dapr/dapr       1.8.3           1.8.3           A Helm chart for Dapr on Kubernetes
dapr/dapr       1.8.2           1.8.2           A Helm chart for Dapr on Kubernetes
dapr/dapr       1.8.1           1.8.1           A Helm chart for Dapr on Kubernetes
dapr/dapr       1.8.0           1.8.0           A Helm chart for Dapr on Kubernetes
dapr/dapr       1.8.0-rc.8      1.8.0-rc.8      A Helm chart for Dapr on Kubernetes
dapr/dapr       1.8.0-rc.7      1.8.0-rc.7      A Helm chart for Dapr on Kubernetes
dapr/dapr       1.8.0-rc.6      1.8.0-rc.6      A Helm chart for Dapr on Kubernetes
dapr/dapr       1.8.0-rc.5      1.8.0-rc.5      A Helm chart for Dapr on Kubernetes
dapr/dapr       1.8.0-rc.4      1.8.0-rc.4      A Helm chart for Dapr on Kubernetes
dapr/dapr       1.8.0-rc.3      1.8.0-rc.3      A Helm chart for Dapr on Kubernetes
dapr/dapr       1.8.0-rc.2      1.8.0-rc.2      A Helm chart for Dapr on Kubernetes

3、创建dapr的命名空间

kubectl create namespace dapr-system

4、在对应的命名空间内初始化dapr

helm install dapr dapr/dapr --namespace dapr-system --wait

等待出现一下提示信息则认为安装成功

[root@master ~]# helm install dapr dapr/dapr --namespace dapr-system --wait
NAME: dapr
LAST DEPLOYED: Mon Aug 15 10:56:49 2022
NAMESPACE: dapr-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Thank you for installing Dapr: High-performance, lightweight serverless runtime for cloud and edge

Your release is named dapr.

To get started with Dapr, we recommend using our quickstarts:
https://github.com/dapr/quickstarts

For more information on running Dapr, visit:
https://dapr.io

如果要卸载dapr则

helm uninstall dapr --namespace dapr-system

4、验证

查看k8s下的pod是否完全启动

kubectl get pods --namespace dapr-system

以下为正确启动

[root@master ~]# kubectl get pods --namespace dapr-system
NAME                                     READY   STATUS    RESTARTS   AGE
dapr-dashboard-58c4b748fc-9tngf          1/1     Running   0          14m
dapr-operator-7dcdd6d9f4-99t4p           1/1     Running   4          14m
dapr-placement-server-0                  1/1     Running   4          14m
dapr-sentry-866d974f9c-59b5g             1/1     Running   4          14m
dapr-sidecar-injector-56798bbddf-qwdp4   1/1     Running   5          14m

查看dapr集群状态

dapr status -k

以下为正确启动

[root@master linux-amd64]# dapr status -k
  NAME                  NAMESPACE    HEALTHY  STATUS   REPLICAS  VERSION  AGE  CREATED              
  dapr-sidecar-injector  dapr-system  True     Running  1         1.8.4    27m  2022-08-15 10:56.50  
  dapr-sentry            dapr-system  True     Running  1         1.8.4    27m  2022-08-15 10:56.50  
  dapr-placement-server  dapr-system  True     Running  1         1.8.4    26m  2022-08-15 10:56.57  
  dapr-operator          dapr-system  True     Running  1         1.8.4    27m  2022-08-15 10:56.50  
  dapr-dashboard         dapr-system  True     Running  1         0.10.0   27m  2022-08-15 10:56.50

你可能感兴趣的:(kubernetes,linux,云原生)