国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

Deploy MySQL using Helm in Kubernetes with Persist

zhoutk / 887人閱讀

摘要:

How to deploy MySQL-Server Docker using Helm Chart in Kubernetes with Persistent Volume!

Pull MySQL Server docker image from Docker repository, tag it as
appreciate, then push to private repository.

docker pull mysql/mysql-server:5.7.21 docker tag
mysql/mysql-server:5.7.21 qio01:5000/mysql-server:latest 
docker push

Exec helm init to initialize Helm Chart.

Edit Chart.yaml. This is optional, it is just to provide information of your deployment and make it more professional.

description: MySQL is the world"s most popular open source database. With its proven performance, reliability, and ease-of-use, MySQL has become the leading choice of database for web applications of all sorts, ranging from personal websites and small online shops all the way to large-scale, high profile web operations like Facebook, Twitter, and YouTube.
home: http://www.mysql.com
icon: https://www.mysql.com/common/logos/logo-mysql-170x115.png
keywords:
- component=repo.mysql.com/yum/mysql-5.7-community/docker/x86_64/mysql-community-server-minimal-5.7.21-1.el7.x86_64.rpm
maintainers:
- email: hiroshifuu@outlook.com
  name: Feng Hao
name: mysqldb
sources:
- https://hub.docker.com/r/mysql/mysql-server/
version: 1.0

Edit values.yaml. You may want to specific the password, by setting mysqldbPassword: password.

image:
  pullPolicy: IfNotPresent
  repository: qio01:5000/mysql-server
  tag: latest
persistence:
  accessMode: ReadWriteOnce
  enabled: true
  size: 40Gi
  storageClass: standard
resources:
  requests:
    memory: 512Mi
    cpu: 500m
serviceType: ClusterIP
mysqldbPassword: password

Create secret.yaml. If you have defined the mysqlRootPassword, the password will be configured. You could define a different password for root in the values.yaml by setting mysqlRootPassword.

apiVersion: v1
kind: Secret
metadata:
  name: {{ template "fullname" . }}
  labels:
    app: {{ template "fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
type: Opaque
data:
  mysqldb-root-password: {{ default "" .Values.mysqlRootPassword | b64enc | quote }}
  mysqldb-password: {{ default "" .Values.mysqldbPassword | b64enc | quote }}
{{- if .Values.mysqlRootPassword }}
  data-source-name: {{ printf "root%s@(localhost:3306)/" .Values.mysqlRootPassword | b64enc | quote}}
{{- else }}
  data-source-name: {{ printf "root@(localhost:3306)/" | b64enc | quote}}
{{- end }}

Edit deployment.yaml. A few things you might be interested to look at. The env configurations. MySQL user password, root password, default database, and allow for empty password all can be found here. The most important configuration is the mountPath of volumeMounts. This is for persistent storage, you need to set the mountPath correctly, different MySQL distribution will use different path.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: {{ template "fullname" . }}
  labels:
    app: {{ template "fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
spec:
  template:
    metadata:
      labels:
        app: {{ template "fullname" . }}
        release: {{ .Release.Name }}
        component: "{{.Release.Name}}"
        nautilian.snapshot.enabled: "true"
    spec:
      containers:
      - name: {{ template "fullname" . }}
        image: {{ .Values.image.repository}}:{{ .Values.image.tag}}
        imagePullPolicy: {{ .Values.image.pullPolicy }}
        env:
        - name: MYSQLDB_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: {{ template "fullname" . }}
              key: mysqldb-root-password
        - name: MYSQLDB_USER
          value: {{ default "" .Values.mysqldbUser | quote }}
        - name: MYSQLDB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: {{ template "fullname" . }}
              key: mysqldb-password
        - name: MYSQLDB_DATABASE
          value: {{ default "" .Values.mysqldbDatabase | quote }}
        - name: ALLOW_EMPTY_PASSWORD
          value: "yes"
        ports:
        - name: mysql
          containerPort: 3306
        livenessProbe:
          exec:
            command:
            - mysqladmin
            - ping
          initialDelaySeconds: 30
          timeoutSeconds: 5
        readinessProbe:
          exec:
            command:
            - mysqladmin
            - ping
          initialDelaySeconds: 5
          timeoutSeconds: 1
        resources:
{{ toYaml .Values.resources | indent 10 }}
        volumeMounts:
        - name: data
          mountPath: /var/lib/mysql
      volumes:
      - name: config
        configMap:
          name: {{ template "fullname" . }}
      - name: data
      {{- if .Values.persistence.enabled }}
        persistentVolumeClaim:
          claimName: {{ .Values.persistence.existingClaim | default (include "fullname" .) }}
      {{- else }}
        emptyDir: {}
      {{- end -}}

Create svc.yaml to create a service in kubernetes.

apiVersion: v1
kind: Service
metadata:
  name: {{ template "fullname" . }}
  labels:
    app: {{ template "fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
spec:
  type: {{ .Values.serviceType }}
  ports:
  - name: mysql
    port: 3306
    targetPort: 3306
  selector:
    app: {{ template "fullname" . }}

Create pvc.yaml for the persistent volume.

{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: {{ template "fullname" . }}
  labels:
    app: {{ template "fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
    heritage: "{{ .Release.Service }}"
  annotations:
  {{- if .Values.persistence.storageClass }}
    volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
  {{- else }}
    volume.alpha.kubernetes.io/storage-class: default
  {{- end }}
spec:
  accessModes:
    - {{ .Values.persistence.accessMode | quote }}
  resources:
    requests:
      storage: {{ .Values.persistence.size | quote }}
{{- end }}

Deploy using helm install.

$ helm install  --name  --namespace  name

Login to the shell of the Pod to do MySQL configurations. Grant all privileges on that database and (in the future) tables. WITH GRANT OPTION creates a MySQL user that can edit the permissions of other users.

ALTER USER "root"@"localhost" IDENTIFIED BY "password";
GRANT ALL PRIVILEGES ON *.* TO "root"@"%" IDENTIFIED BY "password";
GRANT ALL PRIVILEGES ON *.* TO "root"@"%" WITH GRANT OPTION;
FLUSH PRIVILEGES;

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/32638.html

相關文章

  • Deploy MySQL using Helm in Kubernetes with Persist

    摘要: How to deploy MySQL-Server Docker using Helm Chart in Kubernetes with Persistent Volume! Pull MySQL Server docker image from Docker repository, tag it asappreciate, then push to private repos...

    Gilbertat 評論0 收藏0
  • Openshift環境安裝K8S軟件管理工具Helm

    摘要:參考中文指南使用管理應用參考官方文檔,環境安裝時其指向安裝客戶端,版本參考。如下所示,在主機安裝當前最新文檔版可選。 參考: Make a Kubernetes Operator in 15 minutes with Helm; Deploy Monocular on OpenShift; Helm中文指南; 使用Helm管理kubernetes應用; https://he...

    Vultr 評論0 收藏0
  • Openshift環境安裝K8S軟件管理工具Helm

    摘要:參考中文指南使用管理應用參考官方文檔,環境安裝時其指向安裝客戶端,版本參考。如下所示,在主機安裝當前最新文檔版可選。 參考: Make a Kubernetes Operator in 15 minutes with Helm; Deploy Monocular on OpenShift; Helm中文指南; 使用Helm管理kubernetes應用; https://he...

    ISherry 評論0 收藏0
  • Kubernetes Helm入門指南

    摘要:由兩部分組成,客戶端和服務端。其中運行在集群上,管理,而客戶端就是一個命令行工具,可在本地運行,一般運行在持續集成持續交付的服務器上。命令行中的參數可以根據需要改成你自己期望的名字。 什么是Helm?這可不是暗黑破壞神里裝備的名稱:頭盔,而是Kubernetes的一個包管理工具,用來簡化Kubernetes應用的部署和管理。我們Helm和Kubernetes的關系,我們可以理解成yum...

    617035918 評論0 收藏0

發表評論

0條評論

zhoutk

|高級講師

TA的文章

閱讀更多
最新活動
閱讀需要支付1元查看
<