K8s:部署MySQL:修订间差异

来自WHY42
Riguz留言 | 贡献
Riguz留言 | 贡献
第22行: 第22行:
kubectl describe secret mysql-secrets
kubectl describe secret mysql-secrets
</syntaxhighlight>
</syntaxhighlight>
== 创建持久化卷==
<syntaxhighlight lang="yaml">
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-data-disk
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100m
</syntaxhighlight>
<syntaxhighlight lang="bash">
kubectl apply -f mysql-volume.yml
kubectl get persistentvolumeclaim
kubectl describe persistentvolumeclaim mysql-data-disk
</syntaxhighlight>
[[Category:Linux/Unix]]
[[Category:Linux/Unix]]

2021年9月16日 (四) 12:34的版本

部署mysql5.7

创建密码

echo -n "1125482715" | base64

mysql-secret.yml:

---
apiVersion: v1
kind: Secret
metadata:
  name: mysql-secrets
type: Opaque
data:
  ROOT_PASSWORD: MTEyNTQ4MjcxNQ==
kubectl apply -f mysql-secret.yml
kubectl get secret
kubectl describe secret mysql-secrets

创建持久化卷

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-data-disk
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100m
kubectl apply -f mysql-volume.yml
kubectl get persistentvolumeclaim
kubectl describe persistentvolumeclaim mysql-data-disk