Last active
November 6, 2023 00:40
-
-
Save nelsonyaccuzzi/e99e931224f483b92ac93ddc1ed01907 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: mysql | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: mysql | |
namespace: mysql | |
spec: | |
ports: | |
- port: 3306 | |
selector: | |
app: mysql | |
clusterIP: None | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: mysql | |
namespace: mysql | |
spec: | |
selector: | |
matchLabels: | |
app: mysql | |
strategy: | |
type: Recreate | |
template: | |
metadata: | |
labels: | |
app: mysql | |
spec: | |
containers: | |
- image: mysql:8 | |
name: mysql | |
env: | |
- name: MYSQL_ROOT_PASSWORD | |
# value: devops2020 | |
valueFrom: | |
secretKeyRef: | |
name: mysql-root-password | |
key: MYSQL_ROOT_PASSWORD | |
- name: MYSQL_DATABASE | |
valueFrom: | |
secretKeyRef: | |
name: mysql-root-password | |
key: MYSQL_DATABASE | |
- name: MYSQL_USER | |
valueFrom: | |
secretKeyRef: | |
name: mysql-root-password | |
key: MYSQL_USER | |
- name: MYSQL_PASSWORD | |
valueFrom: | |
secretKeyRef: | |
name: mysql-root-password | |
key: MYSQL_PASSWORD | |
ports: | |
- containerPort: 3306 | |
name: mysql | |
volumeMounts: | |
- name: mysql-persistent-storage | |
mountPath: /var/lib/mysql | |
volumes: | |
- name: mysql-persistent-storage | |
hostPath: | |
path: /home/elon/mysql | |
type: Directory | |
--- | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: mysql-root-password | |
namespace: mysql | |
type: Opaque | |
data: | |
MYSQL_ROOT_PASSWORD: ZGV2b3BzMjAyMA== | |
MYSQL_DATABASE: ZGV2b3Bz | |
MYSQL_USER: ZWxvbg== | |
MYSQL_PASSWORD: bXVzaw== | |
# kubectl run -n mysql -it --rm --image=mysql:8 --restart=Never mysql-client -- mysql -hmysql -uelon -pmusk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment