Steps to reproduce the demos at the presentation, using mysql-k8s, mysql-router-k8s, tls-certificates and s3-integrator operators.
We assume a kubernetes juju controller already in place case not, follow the instructions at microk8s in juju
# add a new juju model
juju add-model operator-day
# deploy the MySQL operator from edge channel
juju deploy mysql-k8s --channel edge --trust
# Take a look at the available actions for the operator
juju actions mysql-k8s
# Check cluster status by calling action
juju run-action mysql-k8s/0 get-cluster-status --wait
# Now, scale out to a fault tolerant cluster (3 instances)
juju scale-application mysql-k8s 3
# Check cluster status again to validate the three node cluster
juju run-action mysql-k8s/0 get-cluster-status --wait
# Let's try to kill the primary instance of the cluster
# **Note** the juju model name is the k8s namespace
kubectl -n operador-day delete pod/mysql-k8s-0
# While the cluster recover, let's retrieve dabatase root user password
# we are using unit 1 since unit 0 may not be available yet
juju run-action mysql-k8s/1 get-password user=root --wait# Deployment of mysql-router and test application
juju deploy mysql-router-k8s --channel edge
juju deploy mysql-test-app app --channel edge
# Relate mysql <-> mysql-router <-> test-app
juju relate mysql-router-k8s mysql-k8s
juju relate app mysql-router-k8s
# The test application start a continuous writes after relations are settled
# the router ip can be found on the output of `juju status`
mysqlsh --sql root:<password>@<mysql-router-ip>:6446 # or 6447 for read-only/replicas accessTo check the continuous writes, try the query:
select max(number) from continuous_writes_database.data; and to stop the writes:
juju run-action app/0 stop-continuous-writes --waitValidate default encryption
mysqlsh --sql root:<password>@<any-mysql-unit>:3306and on the mysqlsh prompt run \status
Repeat the procedure with:
mysqlsh --sql root:<password>@<any-mysql-unit>:3306 --ssl-mode=DISABLED
# connection is still possibleDeploy tls-certificates-operator:
juju deploy tls-certificates-operator tls \
--config generate-self-signed-certificates=true \
--config ca-common-name="My CA"
# and relate
juju relate tls mysql-k8s
mysqlsh --sql root:<password>@<any-mysql-unit>:3306 --ssl-mode=DISABLED
# connection is not possible# For backups, let's use a new model.
juju add-model dev
# Deploy single node cluster
juju deploy -n 1 mysql-k8s --series=jammy --channel=latest/edge
# Feploy S3 integrator setting configuratuion
juju deploy -n 1 s3-integrator --series=jammy --channel=latest/edge --config bucket=<bucket> --config path=<path>
# Run sync credentials action
juju run-action s3-integrator/0 --wait --format yaml sync-s3-credentials access-key=<access-key> secret-key=<secret-key>
# and relate apps
juju relate mysql-k8s s3-integrator
# List any existing backups for the given account
juju run-action mysql-k8s/0 --wait --format yaml list-backups
# Run the backup
juju run-action mysql-k8s/0 --wait --format yaml create-backup# Rotate user credentials
juju run-action mysql-k8s/0 --wait --format yaml set-password username=root password=<password>
juju run-action mysql-k8s/0 --wait --format yaml set-password username=serverconfig password=<password>
juju run-action mysql-k8s/0 --wait --format yaml set-password username=clusteradmin password=<password>
# Restore a given backup from S3
juju run-action mysql-k8s/0 --wait --format yaml restore backup-id=<id>