In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to run a wordpress in K8s". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
K8s deployment wordpress official example method
It is easy to use K8s to run a wordpress, but it is difficult and difficult to say that the basic requirements are relatively high, which involves Service,persistentVolumeClaim,volumes
According to the tutorial, it only takes a few lines of code to do it.
First, create a kustomization.yaml file with the following contents
SecretGenerator:-name: mysql-pass literals:-password=123456resources:-mysql-deployment.yaml-wordpress-deployment.yaml# download two configuration files curl-LO https://k8s.io/examples/application/wordpress/mysql-deployment.yamlcurl-LO https://k8s.io/examples/application/wordpress/wordpress-deployment.yaml# and finally run kubectl apply-k. # to view the exposed IPkubectl get services wordpress
About kustomize
To put it simply, one tool reduces the workload of maintaining multiple sets of environment yaml
Pain points solved by kustomize
In general, there will be multiple sets of deployment environment: development environment, test environment, production environment, multiple sets of environment means that there are multiple sets of K8S application resources YAML. However, there are only minor configuration differences among so many sets of YAML, such as different image versions and different Label, and YAML in these different environments often lead to configuration errors due to human negligence. Furthermore, YAML maintenance for multiple environments is usually done by copying the YAML in one environment and modifying the differences. Some application management tools such as Helm require additional learning of DSL syntax. To sum up, there are many sets of applications in K8s environment, and the following problems are often encountered:
How to manage Kubernetes YAML resources of applications in different environments or different teams how to manage small differences in different environments in some way, so that resource configuration can be reused, reduce the workload of copy and change, how to simplify the process of maintaining applications, there is no need to learn additional template syntax Kustomize solves the above problems in the following ways:
Kustomize maintains application configuration in different environments through Base & Overlays (explained later). Kustomize uses patch to reuse Base configuration, and implements resource reuse in the part where Overlay describes the difference between Overlay and Base application configuration. Kustomize manages Kubernetes native YAML files and does not need to learn additional DSL syntax.
Be careful
Since the official service type is LoadBalancer, this is only valid for deployment to the public cloud. If you use the self-built k8s, you can use NodePort's service to provide a reference example.
ApiVersion: v1kind: Servicemetadata: name: service-wordpress labels: app: wordpressspec: selector: app: wordpress tier: frontend type: NodePort # service type ports:-port: 80 # by default, `targetPort` is set to the same value as the `port` field for convenience. NodePort: 30012 # specifies the port of the bound node (the default value range is 30000-32767). If it is not specified, it will be assigned by default targetPort: 80 "how to run a wordpress in K8s". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.