Setup dapr on AWS and calico
- 2 minutes read - 286 wordsLow resource usage
Our system had low resource usage, however my several pods got stucked in ContainerCreating state. Kubernetes events show that "add cmd: failed to assign an IP address to container". "kubectl top nodes" still shows the usage of resources still low.
jackl@LAPTOP-IIHUF2DR:~$ k --context jack.l@test-dev.ap-southeast-1.eksctl.io top nodes NAME CPU(cores) CPU% MEMORY(bytes) MEMORY% ip-192-168-102-109.ap-southeast-1.compute.internal 143m 7% 3217Mi 45% ip-192-168-110-171.ap-southeast-1.compute.internal 117m 6% 2892Mi 41%
Migrate to calico
-
Recreate cluster without nodegroups
-
delete aws-node daemonsets
-
apply calico-vxlan
-
create nodegroups
# v3.20.2
# https://projectcalico.docs.tigera.io/manifests/calico-vxlan.yaml
export AWS_PROFILE=test-dev
eksctl create cluster -f test-dev-cluster.yaml --without-nodegroup
kubectl delete daemonset -n kube-system aws-node
kubectl apply -f calico-vxlan.yaml
eksctl create nodegroup -f test-dev-cluster.yaml
Issue: I don’t see the Dapr sidecar injected to my pod
# https://github.com/dapr/dapr/pull/4179#issue-1119608603
dapr_sidecar_injector:
hostNetwork: true
# port conflict etc, need to change port
healthzPort: 8091
helm repo add dapr https://dapr.github.io/helm-charts/
helm repo update
# See which chart versions are available
helm search repo dapr --devel --versions
#--version is needed
helm upgrade --install dapr dapr/dapr \
--version=1.7.2 \
--namespace dapr-system \
--create-namespace \
--values values.yaml
# prefer to
dapr init -k \
--set dapr_sidecar_injector.hostNetwork=true,dapr_sidecar_injector.healthzPort=8091
Debug
//.vscode/launch.json
{
"configurations": [
{
"name": "Launch divideapp with Kubernetes",
"program": "${workspaceFolder}/app.js",
"request": "launch",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"preLaunchTask": "bridge-to-kubernetes.resource",
"env": {
"GRPC_DNS_RESOLVER": "native"
},
},
{
"name": "Launch divideapp",
"program": "${workspaceFolder}/app.js",
"request": "launch",
"skipFiles": [
"<node_internals>/**"
],
"type": "node"
}
]
}
//.vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "bridge-to-kubernetes.resource",
"type": "bridge-to-kubernetes.resource",
"resource": "divideapp-dapr",
"resourceType": "service",
"ports": [
4000 //match the port number in code
],
"targetCluster": "arn:aws:eks:ap-southeast-1:372827928396:cluster/cnpsp",
"targetNamespace": "default",
"useKubernetesServiceEnvironmentVariables": true
}
]
}
git clone https://github.com/dapr/quickstarts.git
cd quickstarts/tutorials/distributed-calculator/deploy
kubectl apply -f .
cd node
yarn install
code .
vscode
Debug only when the pod is ready |