1
1
---
2
- title : Mysql Rotateauth Guide
2
+ title : MySQL Rotateauth Guide
3
3
menu :
4
4
docs_{{ .version }} :
5
5
identifier : mysql-rotate-auth-guide
@@ -10,9 +10,9 @@ menu_name: docs_{{ .version }}
10
10
section_menu_id : guides
11
11
---
12
12
13
- # Rotate Authentication of Mysql
13
+ # Rotate Authentication of MySQL
14
14
15
- ** Rotate Authentication** is a feature of the KubeDB Ops-Manager that allows you to rotate a ` Mysql `
15
+ ** Rotate Authentication** is a feature of the KubeDB Ops-Manager that allows you to rotate a ` MySQL `
16
16
user's authentication credentials using a ` MySQLopsrequest ` . There are two ways to perform this
17
17
rotation.
18
18
@@ -48,77 +48,24 @@ updates the existing secret with the new credential.
48
48
When you have installed KubeDB, it has created ` MySQLVersion ` crd for all supported MySQL versions. Check it by using the following command,
49
49
50
50
``` bash
51
- $ kubectl get Mysqlversions
51
+ $ kubectl get mysqlversion
52
52
NAME VERSION DISTRIBUTION DB_IMAGE DEPRECATED AGE
53
- 5 5 Official ghcr.io/kubedb/mysql:5 true 25h
54
- 5-v1 5 Official ghcr.io/kubedb/mysql:5-v1 true 25h
55
- 5.7 5.7 Official ghcr.io/kubedb/mysql:5.7 true 25h
56
- 5.7-v1 5.7 Official ghcr.io/kubedb/mysql:5.7-v1 true 25h
57
- 5.7-v2 5.7.25 Official ghcr.io/kubedb/mysql:5.7-v2 true 25h
58
- 5.7-v3 5.7.25 Official ghcr.io/kubedb/mysql:5.7.25 true 25h
59
- 5.7-v4 5.7.29 Official ghcr.io/kubedb/mysql:5.7.29 true 25h
60
- 5.7.25 5.7.25 Official ghcr.io/kubedb/mysql:5.7.25 true 25h
61
- 5.7.25-v1 5.7.25 Official ghcr.io/kubedb/mysql:5.7.25-v1 true 25h
62
- 5.7.25-v2 5.7.25 Official ghcr.io/kubedb/mysql:5.7.25-v2 true 25h
63
- 5.7.25-v3 5.7.25 Official mysql:5.7.25 true 25h
64
- 5.7.29 5.7.29 Official ghcr.io/kubedb/mysql:5.7.29 true 25h
65
- 5.7.29-v1 5.7.29 Official mysql:5.7.29 true 25h
66
- 5.7.29-v2 5.7.29 Official mysql:5.7.29 true 25h
67
- 5.7.31 5.7.31 Official ghcr.io/kubedb/mysql:5.7.31 true 25h
68
- 5.7.31-v1 5.7.31 Official ghcr.io/kubedb/mysql:5.7.31-v1 true 25h
69
- 5.7.31-v2 5.7.31 Official mysql:5.7.31 true 25h
70
- 5.7.33 5.7.33 Official ghcr.io/kubedb/mysql:5.7.33 true 25h
71
- 5.7.33-v1 5.7.33 Official mysql:5.7.33 true 25h
72
- 5.7.35 5.7.35 Official ghcr.io/kubedb/mysql:5.7.35 true 25h
73
- 5.7.35-v1 5.7.35 Official mysql:5.7.35 true 25h
74
- 5.7.36 5.7.36 Official mysql:5.7.36 true 25h
75
- 5.7.41 5.7.41 Official ghcr.io/appscode-images/mysql:5.7.41-oracle true 25h
76
- 5.7.42-debian 5.7.42 Official ghcr.io/appscode-images/mysql:5.7.42-debian 25h
77
- 5.7.44 5.7.44 Official ghcr.io/appscode-images/mysql:5.7.44-oracle 25h
78
- 8 8 Official ghcr.io/kubedb/mysql:8 true 25h
79
- 8-v1 8 Official ghcr.io/kubedb/mysql:8-v1 true 25h
80
- 8.0 8.0 Official ghcr.io/kubedb/mysql:8.0 true 25h
81
- 8.0-v1 8.0.3 Official ghcr.io/kubedb/mysql:8.0-v1 true 25h
82
- 8.0-v2 8.0.14 Official ghcr.io/kubedb/mysql:8.0-v2 true 25h
83
- 8.0-v3 8.0.20 Official ghcr.io/kubedb/mysql:8.0.20 true 25h
84
- 8.0.14 8.0.14 Official ghcr.io/kubedb/mysql:8.0.14 true 25h
85
- 8.0.14-v1 8.0.14 Official ghcr.io/kubedb/mysql:8.0.14-v1 true 25h
86
- 8.0.14-v2 8.0.14 Official ghcr.io/kubedb/mysql:8.0.14-v2 true 25h
87
- 8.0.14-v3 8.0.14 Official mysql:8.0.14 true 25h
88
- 8.0.17 8.0.17 Official mysql:8.0.17 true 25h
89
- 8.0.20 8.0.20 Official ghcr.io/kubedb/mysql:8.0.20 true 25h
90
- 8.0.20-v1 8.0.20 Official ghcr.io/kubedb/mysql:8.0.20-v1 true 25h
91
- 8.0.20-v2 8.0.20 Official mysql:8.0.20 true 25h
92
- 8.0.21 8.0.21 Official ghcr.io/kubedb/mysql:8.0.21 true 25h
93
- 8.0.21-v1 8.0.21 Official ghcr.io/kubedb/mysql:8.0.21-v1 true 25h
94
- 8.0.21-v2 8.0.21 Official mysql:8.0.21 true 25h
95
- 8.0.23 8.0.23 Official ghcr.io/kubedb/mysql:8.0.23 true 25h
96
- 8.0.23-v1 8.0.23 Official mysql:8.0.23 true 25h
97
- 8.0.26 8.0.26 Official ghcr.io/kubedb/mysql:8.0.26 true 25h
98
- 8.0.27 8.0.27 Official mysql:8.0.27 true 25h
99
- 8.0.27-innodb 8.0.27 MySQL mysql/mysql-server:8.0.27 true 25h
100
- 8.0.29 8.0.29 Official ghcr.io/appscode-images/mysql:8.0.29-oracle true 25h
101
- 8.0.3 8.0.3 Official ghcr.io/kubedb/mysql:8.0.3 true 25h
102
- 8.0.3-v1 8.0.3 Official ghcr.io/kubedb/mysql:8.0.3-v1 true 25h
103
- 8.0.3-v2 8.0.3 Official ghcr.io/kubedb/mysql:8.0.3-v2 true 25h
104
- 8.0.3-v3 8.0.3 Official mysql:8.0.3 true 25h
105
- 8.0.3-v4 8.0.3 Official mysql:8.0.3 true 25h
106
- 8.0.31 8.0.31 Official ghcr.io/appscode-images/mysql:8.0.31-oracle true 25h
107
- 8.0.31-innodb 8.0.31 MySQL ghcr.io/appscode-images/mysql:8.0.31-oracle 25h
108
- 8.0.32 8.0.32 Official ghcr.io/appscode-images/mysql:8.0.32-oracle true 25h
109
- 8.0.35 8.0.35 Official ghcr.io/appscode-images/mysql:8.0.35-oracle 25h
110
- 8.0.36 8.0.36 Official ghcr.io/appscode-images/mysql:8.0.36-debian 25h
111
- 8.1.0 8.1.0 Official ghcr.io/appscode-images/mysql:8.1.0-oracle 25h
112
- 8.2.0 8.2.0 Official ghcr.io/appscode-images/mysql:8.2.0-oracle 25h
113
- 8.4.2 8.4.2 Official ghcr.io/appscode-images/mysql:8.4.2-oracle 25h
114
- 8.4.3 8.4.3 Official ghcr.io/appscode-images/mysql:8.4.3-oracle 25h
115
- 9.0.1 9.0.1 Official ghcr.io/appscode-images/mysql:9.0.1-oracle 25h
116
- 9.1.0 9.1.0 Official ghcr.io/appscode-images/mysql:9.1.0-oracle 25h
53
+ 5.7.42-debian 5.7.42 Official ghcr.io/appscode-images/mysql:5.7.42-debian 12d
54
+ 5.7.44 5.7.44 Official ghcr.io/appscode-images/mysql:5.7.44-oracle 12d
55
+ 8.0.31-innodb 8.0.31 MySQL ghcr.io/appscode-images/mysql:8.0.31-oracle 12d
56
+ 8.0.35 8.0.35 Official ghcr.io/appscode-images/mysql:8.0.35-oracle 12d
57
+ 8.0.36 8.0.36 Official ghcr.io/appscode-images/mysql:8.0.36-debian 12d
58
+ 8.1.0 8.1.0 Official ghcr.io/appscode-images/mysql:8.1.0-oracle 12d
59
+ 8.2.0 8.2.0 Official ghcr.io/appscode-images/mysql:8.2.0-oracle 12d
60
+ 8.4.2 8.4.2 Official ghcr.io/appscode-images/mysql:8.4.2-oracle 12d
61
+ 8.4.3 8.4.3 Official ghcr.io/appscode-images/mysql:8.4.3-oracle 12d
62
+ 9.0.1 9.0.1 Official ghcr.io/appscode-images/mysql:9.0.1-oracle 12d
63
+ 9.1.0 9.1.0 Official ghcr.io/appscode-images/mysql:9.1.0-oracle 12d
117
64
```
118
65
119
- ## Create a Mysql server
66
+ ## Create a Mysql Database
120
67
121
- KubeDB implements a ` Mysql ` CRD to define the specification of a Mysql server. Below is the ` Mysql `
68
+ KubeDB implements a ` MySQL ` CRD to define the specification of a MySQL server. Below is the ` MySQL `
122
69
object created in this tutorial.
123
70
124
71
``` yaml
@@ -145,7 +92,7 @@ $ kubectl create -f https://github.com/kubedb/docs/raw/{{< param "info.version"
145
92
mysql.kubedb.com/mysql-quickstart created
146
93
```
147
94
148
- ## Verify authentication
95
+ ##Create a Mysql Database
149
96
The user can verify whether they are authorized by executing a query directly in the database. To
150
97
do this, the user needs ` username ` and ` password ` in order to connect to the database. Below is an
151
98
example showing how to retrieve the credentials from the Secret.
@@ -193,9 +140,9 @@ mysql> SHOW DATABASES;
193
140
If you can access the data table and run queries, it means the secrets are working correctly.
194
141
# # Create RotateAuth MySQLopsrequest
195
142
196
- # ### 1. Using operator generated credentials :
143
+ # ### 1. Using Operator Generated Credentials :
197
144
198
- In order to rotate authentication to the Mysql using operator generated, we have to create a
145
+ In order to rotate authentication to the MySQL using operator generated, we have to create a
199
146
` MySQLopsrequest` CR with ` RotateAuth` type. Below is the YAML of the ` MySQLopsrequest` CRO that
200
147
we are going to create,
201
148
` ` ` yaml
@@ -213,8 +160,8 @@ spec:
213
160
` ` `
214
161
Here,
215
162
216
- - ` spec.databaseRef.name` specifies that we are performing rotate authentication operation on ` mysql-quickstart` cluster .
217
- - ` spec.type` specifies that we are performing ` RotateAuth` on Mysql .
163
+ - ` spec.databaseRef.name` specifies that we are performing rotate authentication operation on ` mysql-quickstart` instance .
164
+ - ` spec.type` specifies that we are performing ` RotateAuth` on MySQL .
218
165
219
166
Let' s create the `MySQLopsrequest` CR we have shown above,
220
167
```shell
@@ -223,13 +170,13 @@ Let's create the `MySQLopsrequest` CR we have shown above,
223
170
```
224
171
Let' s wait for ` MySQLopsrequest` to be ` Successful` . Run the following command to watch ` MySQLopsrequest` CRO
225
172
` ` ` shell
226
- $ kubectl get MySQLopsrequest -n demo
173
+ $ kubectl get MySQLOpsRequest -n demo
227
174
NAME TYPE STATUS AGE
228
175
myops-rotate-auth-generated RotateAuth Successful 82s
229
176
` ` `
230
177
If we describe the ` MySQLopsrequest` we will get an overview of the steps that were followed.
231
178
` ` ` shell
232
- $ kubectl describe MySQLopsrequest -n demo myops-rotate-auth-generated
179
+ $ kubectl describe MySQLOpsRequest -n demo myops-rotate-auth-generated
233
180
Name: myops-rotate-auth-generated
234
181
Namespace: demo
235
182
Labels: < none>
@@ -373,7 +320,7 @@ bash-5.1$
373
320
374
321
` ` `
375
322
The above output shows that the password has been changed successfully. The previous username & password is stored for rollback purpose.
376
- # ### 2. Using user created credentials
323
+ # ### 2.Using User Created Credentials
377
324
378
325
At first, we need to create a secret with ` kubernetes.io/basic-auth` type using custom password.
379
326
Below is the command to create a secret with ` kubernetes.io/basic-auth` type,
@@ -419,14 +366,14 @@ MySQLopsrequest.ops.kubedb.com/myops-rotate-auth-user created
419
366
Let’s wait for `MySQLopsrequest` to be Successful. Run the following command to watch `MySQLopsrequest` CRO:
420
367
421
368
```shell
422
- $ kubectl get MySQLopsrequest -n demo
369
+ $ kubectl get MySQLOpsRequest -n demo
423
370
NAME TYPE STATUS AGE
424
371
myops-rotate-auth-generated RotateAuth Successful 35m
425
372
myops-rotate-auth-user RotateAuth Successful 2m18s
426
373
```
427
374
We can see from the above output that the `MySQLopsrequest` has succeeded. If we describe the `MySQLopsrequest` we will get an overview of the steps that were followed.
428
375
```shell
429
- $ kubectl describe MySQLopsrequest -n demo myops-rotate-auth-user
376
+ $ kubectl describe MySQLOpsRequest -n demo myops-rotate-auth-user
430
377
Name: myops-rotate-auth-user
431
378
Namespace: demo
432
379
Labels: <none>
@@ -575,10 +522,10 @@ The above output shows that the password has been changed successfully. The prev
575
522
## Cleaning up
576
523
577
524
To clean up the Kubernetes resources you can delete the CRD or namespace.
578
- Or , you can delete one by one resource by their name by this tutorial , run:
525
+ Alternatively , you can delete individual resources by name. To do so , run:
579
526
580
527
```shell
581
- $ kubectl delete MySQLopsrequest myops -rotate-auth-generated myops-rotate-auth-user -n demo
528
+ $ kubectl delete MySQLOpsRequestmyops -rotate-auth-generated myops-rotate-auth-user -n demo
582
529
MySQLopsrequest.ops.kubedb.com "myops-rotate-auth-generated" "myops-rotate-auth-user" deleted
583
530
$ kubectl delete secret -n demo mysql-quickstart-auth-user
584
531
secret "mysql-quickstart-auth-user" deleted
0 commit comments