helm 实践 mysql
介绍 (Introduction)
As more developers work within distributed environments, tools like Kubernetes have become central to keeping application components standardized across dynamic build and production environments. With the increasing complexity of application ecosystems and the growing popularity of Kuberbetes, tools that help manage resources within Kubernetes clusters have become essential.
随着越来越多的开发人员在分布式环境中工作,诸如Kubernetes之类的工具已成为在动态构建和生产环境中保持应用程序组件标准化的核心。 随着应用程序生态系统的日益复杂和Kuberbetes的日益普及,帮助管理Kubernetes集群中的资源的工具变得至关重要。
Helm is an open-source package manager for Kubernetes that simplifies the process of deploying and upgrading applications on a Kubernetes cluster, while also providing a way to find and share ready-to-install applications that are packaged as Kubernetes Charts.
Helm是Kubernetes的开源软件包管理器,它简化了在Kubernetes集群上部署和升级应用程序的过程,同时还提供了一种查找和共享打包为Kubernetes Charts的即插即用应用程序的方法。
In this tutorial, we’ll use Helm for setting up WordPress on top of a Kubernetes cluster, in order to create a highly-available website. In addition to leveraging the intrinsic scalability and high availability aspects of Kubernetes, this setup will help keeping WordPress secure by providing simplified upgrade and rollback workflows via Helm.
在本教程中,我们将使用Helm在Kubernetes集群上设置WordPress ,以创建一个高可用性的网站。 除了利用Kubernetes固有的可扩展性和高可用性方面之外,此设置还将通过Helm提供简化的升级和回滚工作流来帮助保持WordPress的安全。
We’ll be using an external MySQL server in order to abstract the database component, since it can be part of a separate cluster or managed service for extended availability. After completing the steps described in this tutorial, you will have a fully functional WordPress installation within a containerized cluster environment managed by Kubernetes.
我们将使用外部MySQL服务器来抽象化数据库组件,因为它可以作为单独的群集或托管服务的一部分以提高可用性。 完成本教程中描述的步骤后,您将在Kubernetes管理的容器化集群环境中安装功能齐全的WordPress。
先决条件 (Prerequisites)
In order to complete this guide, you will need the following available to you:
为了完成本指南,您将需要以下内容:
A Kubernetes 1.10+ cluster with role-based access control (RBAC) enabled.
启用了基于角色的访问控制 (RBAC)的Kubernetes 1.10+集群。
The
kubectl
command-line tool installed on your local machine or development server, configured to connect to your cluster. Please see the official Kubernetes documentation for instructions on how to set this up.安装在本地计算机或开发服务器上的
kubectl
命令行工具,配置为连接到集群。 请参阅Kubernetes官方文档以获取有关设置方法的说明。The Helm package manager installed on your local machine or development server, and Tiller installed on your cluster, as explained in this tutorial: How To Install Software on Kubernetes Clusters with the Helm Package Manager.
如本教程中所述: 如何在本地计算机或开发服务器上安装Helm软件包管理器,并在群集上安装Tiller: 如何使用Helm软件包管理器在Kubernetes群集上安装软件 。
An external MySQL server with SSH access, and the root MySQL password. To set this up, you can follow one of our MySQL tutorials, such as: How To Install MySQL on Ubuntu 18.04 .
具有SSH访问权限和MySQL 根密码的外部MySQL服务器。 要进行设置,您可以遵循我们MySQL教程之一,例如: 如何在Ubuntu 18.04上安装MySQL 。
Before moving on, make sure you’re able to log into your MySQL server, and that you have connectivity to your Kubernetes cluster. In case you have multiple clusters set up in your kubectl
config file, you should make sure that you’re connected to the correct cluster by running the following command from your local machine or development server:
在继续之前,请确保您能够登录到MySQL服务器,并且已连接到Kubernetes集群。 如果您在kubectl
配置文件中设置了多个集群,则应通过从本地计算机或开发服务器运行以下命令来确保已连接到正确的集群:
- kubectl config get-contexts kubectl配置获取上下文
This is an example output:
这是一个示例输出:
Output
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* do-sfo2-wordpress-cluster do-sfo2-wordpress-cluster do-sfo2-wordpress-cluster-admin
minikube minikube minikube
The asterisk sign (*) indicates which cluster is currently the default context. In case you need to change the current context, run:
星号(*)表示当前是默认上下文的群集。 如果需要更改当前上下文,请运行:
kubectl config use-context context-name
kubectl配置使用上下文上下文名称
You should now be ready to follow the rest of the guide.
现在,您应该准备按照指南的其余部分进行操作。
第1步-配置MySQL (Step 1 — Configuring MySQL)
First, we’ll create a d