Created
February 2, 2021 17:24
-
-
Save vfarcic/5ddd287b16616dbe87f48250a1bb0bf1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minikube start --cpus 2 --memory 8192 | |
git clone https://github.com/vfarcic/couchbase-demo.git | |
cd couchbase-demo | |
# TODO: Switch to Argo CD | |
# To get the files, we need to provide info through https://www.couchbase.com/downloads, including to agree on receiving marketing emails | |
kubectl apply --filename k8s/crd.yaml | |
# Uses `cbopcfg` binary. | |
# I wan't everything in Git and managed through Argo CD or Flux. | |
# Outputting the files with `cbopcfg` and pushing them to Git. | |
# Are we supposed to use that binary every time we need to upgrade the app? | |
# Helm is not working correctly, so that's not an option | |
# Namespace is embedded into the output definitons, so we won't be able to reuse the same definitions for different environments. | |
# Should I strip out `namespace` from the definitions? | |
kubectl create namespace couchbase | |
# `k8s/admission.yaml` was generated from `cbopcfg generate admission --namespace couchbase | tee k8s/admission.yaml` | |
kubectl apply --filename k8s/admission.yaml | |
# `k8s/operator.yaml` was generated from `cbopcfg generate operator --namespace couchbase | tee k8s/operator.yaml` | |
kubectl apply --filename k8s/operator.yaml | |
# Why should we use the binary for the operator but not for the cluster? | |
export CB_USER=$(echo "admin" | base64) | |
export CB_PASS=$(echo "admin" | base64) | |
# I'm not going to store the secret in a file as in https://docs.couchbase.com/operator/current/howto-couchbase-create.html | |
# TODO: Change to sealed secrets. | |
echo "apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: couchbase-auth | |
type: Opaque | |
data: | |
username: $CB_USER | |
password: $CB_PASS" \ | |
| kubectl --namespace couchbase \ | |
apply --filename - | |
# echo "apiVersion: couchbase.com/v2 | |
# kind: CouchbaseBucket | |
# metadata: | |
# name: default | |
# spec: | |
# memoryQuota: 128Mi" \ | |
# | kubectl --namespace couchbase \ | |
# apply --filename - | |
kubectl --namespace couchbase \ | |
apply --filename k8s/cluster.yaml | |
kubectl --namespace couchbase \ | |
get pods | |
kubectl --namespace couchbase \ | |
logs cb-example-0000 | |
# It says that logs are `available in /opt/couchbase/var/lib/couchbase/logs`? | |
kubectl -n couchbase exec -it cb-example-0000 -- sh | |
ls -la /opt/couchbase/var/lib/couchbase/logs | |
# Do we need all those logs? | |
# Is that a DB consisting of multiple components dumped into a single container? | |
# Let's see the processes... | |
ps aux | |
# Yep. It's dumped into a single container. | |
# Is that a container with all the `services` defined in cluster.yaml? | |
exit | |
kubectl --namespace couchbase \ | |
get pods | |
vim k8s/cluster.yaml | |
# Change the `image` to `6.6.0` | |
kubectl --namespace couchbase \ | |
apply --filename k8s/cluster.yaml | |
# TODO: Continue | |
watch kubectl --namespace couchbase \ | |
get pods | |
helm upgrade --install \ | |
couchbase couchbase/couchbase-operator \ | |
--namespace couchbase \ | |
--set cluster.servers.cluster.size=3 \ | |
--reuse-values | |
watch kubectl --namespace couchbase \ | |
get pods | |
# Scale up and down (automatically) | |
kubectl edit cbc cb-example | |
# Change the `image` to `couchbase/server:6.5.1` | |
watch kubectl get pods | |
kubectl edit cbc cb-example | |
# Change the `size` to `2` | |
# TODO: What created those Pods? It's not Deployment, ReplicaSet, StatefulSet | |
kubectl port-forward cb-example-0004 8091 | |
bin/cbopcfg | kubectl delete -f - | |
kubectl delete -f crd.yaml | |
# NOTE: Docs are awesome | |
# NOTE: https://docs.couchbase.com/operator/current/howto-couchbase-update.html proposes commands like `kubectl replace` and `kubectl edit` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment