Dapr deploy
wget -q <https://raw.githubusercontent.com/dapr/cli/master/install/install.sh> -O - | /bin/bash
dapr init --kubernetes --wait
Dapr 확장 만들기
az extension add --name k8s-extension
az extension update --name k8s-extension
az provider list --query "[?contains(namespace,'Microsoft.KubernetesConfiguration')]" -o table
az provider register --namespace Microsoft.KubernetesConfiguration
az k8s-extension create --cluster-type managedClusters \
--cluster-name aks-cluster \
--resource-group aks-test \
--name dapr \
--extension-type Microsoft.Dapr \
--auto-upgrade-minor-version true \
--release-train stable
Azure potal에서 redis cache 생성
Azure Cache for Redis의 설정 항목 밑에 액세스 키에서 키 복사 후 secret 생성 및 배포
kubectl create secret generic redis --from-literal=redis-password=<your-redis-password>
redis.yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: statestore
spec:
type: state.redis
version: v1
metadata:
# These settings will work out of the box if you use `helm install
# bitnami/redis`. If you have your own setup, replace
# `redis-master:6379` with your own Redis master address, and the
# Redis password with your own Secret's name. For more information,
# see <https://docs.dapr.io/operations/components/component-secrets> .
- name: redisHost
value: kblee-redis.redis.cache.windows.net:6379
- name: redisPassword
secretKeyRef:
name: redis-secret
key: redis-password
- name: enableTLS
value: true
auth:
secretStore: kubernetes
cd quickstarts/tutorials/hello-kubernetes
kubectl apply -f ./deploy/redis.yaml
kubectl apply -f ./deploy/node.yaml
# 로그
dapr logs --app-id nodeapp --pod-name nodeapp-7bbf67cd77-zd4md -k
kubectl get all
curl 20.200.231.247/ports
output :
{"DAPR_HTTP_PORT":"3500","DAPR_GRPC_PORT":"50001"}
curl --request POST --data "@sample.json" --header Content-Type:application/json 20.200.231.247/neworder
output :
Empty reply from server
curl 20.200.231.247/order
output :
{ "orderId": "42" }
kubectl apply -f ./deploy/python.yaml
kubectl logs --selector=app=node -c node --tail=-1
output :
Got a new order! Order ID: 1
Successfully persisted state.
Got a new order! Order ID: 2
Successfully persisted state.
Got a new order! Order ID: 3
Successfully persisted state.
kubectl logs --selector=app=node -c daprd --tail=-1
kubectl logs --selector=app=python -c daprd --tail=-1
'DevOps' 카테고리의 다른 글
FortiGate 방화벽의 SNMP 를 이용한 Grafana Dashboard (0) | 2023.10.10 |
---|---|
Jenkins + Argo CD (kaniko, harbor, cert-manager) (0) | 2023.08.11 |
Kaniko (0) | 2023.05.23 |
Harbor (1) | 2023.05.23 |
ArgoCD Image Updater (현재 Beta 버전) (0) | 2023.02.24 |