The motivation for this was a need to test a DNS SRV lookup scenario under Kubernetes, but this should be reusable in general
- Get KIND, Kubernetes in Docker
- Set up a K8S cluster. I used 1.20. From the k8s directory in this repo,
kind create cluster --config kind-config.yaml --name appdemo
- Deploy Couchbase Operator/DAC. From the k8s/kube-deployment directory…
kubectl apply -f couchbase-crd.yaml
then the same for the secrets, then the same for thecb-operator-dac-deployment.yaml
- Deploy Couchbase Server.
kubectl apply -f cb-cluster-buckets-users.yaml
- Build the .NET app from the dockerfile and push it to KIND. From the root…
docker build -t dotnetappdemo:0.4 .
andkind load --name appdemo docker-image dotnetappdemo:0.4
- Deploy the app and look at the log output:
kubectl apply -f dotnetexample.yaml
andkubectl logs -f service/dotnetexample
Do note that the above steps require a little bit of time between each one. Probably just enough to copy and paste, but as an example the DAC needs to be deployed before creating a cluster.
- Properly use secrets from the app
- Set up a way to attach a debugger
- Have a better app that doens't exit and maybe sticks around with HTTP endpoints for making it do things.
- Prometheus.
To check the DNS SRV records, the DNS utils pod may be deployed. Then you can check like so:
kube-deployment % kubectl exec -ti dnsutils -- nslookup -q=SRV _couchbase._tcp.cb-appdemo.default.svc
Server: 10.96.0.10
Address: 10.96.0.10#53
_couchbase._tcp.cb-appdemo.default.svc.cluster.local service = 0 33 11210 cb-appdemo-0000.cb-appdemo.default.svc.cluster.local.
_couchbase._tcp.cb-appdemo.default.svc.cluster.local service = 0 33 11210 cb-appdemo-0001.cb-appdemo.default.svc.cluster.local.
_couchbase._tcp.cb-appdemo.default.svc.cluster.local service = 0 33 11210 cb-appdemo-0002.cb-appdemo.default.svc.cluster.local.
Issue related MichaCo/DnsClient.NET#4 (comment)