입문
얼레벌레
Helm으로 설치하는 법
helm install myapp myapp
커스터마이징
helm search repo redis
kubectl get pods
kubectl get pods --all-namespaces
kubectl describe pod myapp-59dfcd78fc-wmmpv -n myapp
helm install -f values.yaml mongodb bitnami-aks/mongodb
helm list --all
kubectl get all
포트포워딩
kubectl port-forward mongodb-778bb6678b-j7g78 27018:27017
kubectl port-forward redis-master-0 6379:6379
kubectl port-forward pod/redis-master-0 6379:6379
mongodb-7d4ff55555-bwhtn
helm inspect values bitnami-aks/mongodb
helm inspect chart bitnami-aks/redis
MongoDB ReplicaSet 방식으로 생성하기...
MongoDB® can be accessed on the following DNS name(s) and ports from within your cluster:
mongodb-0.mongodb-headless.default.svc.cluster.local:27017
mongodb-1.mongodb-headless.default.svc.cluster.local:27017
To get the root password run:
export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace default mongodb -o jsonpath="{.data.mongodb-root-password}" | base64 --decode)
To connect to your database, create a MongoDB® client container:
kubectl run --namespace default mongodb-client --rm --tty -i --restart='Never' --env="MONGODB_ROOT_PASSWORD=$MONGODB_ROOT_PASSWORD" --image marketplace.azurecr.io/bitnami/mongodb:4.4.9-debian-10-r0 --command -- bash
Then, run the following command:
mongo admin --host "mongodb-0.mongodb-headless.default.svc.cluster.local:27017,mongodb-1.mongodb-headless.default.svc.cluster.local:27017" --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD
To connect to your database nodes from outside, you need to add both primary and secondary nodes hostnames/IPs to your Mongo client. To obtain them, follow the instructions below:
MongoDB® nodes domain: you can reach MongoDB® nodes on any of the K8s nodes external IPs.
MongoDB® nodes port: You will have a different node port for each MongoDB® node. You can get the list of configured node ports using the command below:
echo "$(kubectl get svc --namespace default -l "app.kubernetes.io/name=mongodb,app.kubernetes.io/instance=mongodb,app.kubernetes.io/component=mongodb,pod" -o jsonpath='{.items[*].spec.ports[0].nodePort}' | tr ' ' '\\n')"
kubectl delete pvc --all
kubectl delete pv --all
Kubernetes Dashboard for Windows
'INFRA > KUBERNETES' 카테고리의 다른 글
2024년 CKA 합격 후기 (1) | 2024.12.02 |
---|---|
카프카 환경 구성 (0) | 2022.01.04 |