Skip to content

ethanZhang722/terraform-alicloud-kubernetes-wordpress

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alibaba Cloud terraform example for WordPress + MySQL on Alibaba Cloud Kubernetes

This example is heavily inspired by https://kubernetes.io/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume/

It describes how to use local volume to deploy WordPress and MySQL on Alibaba Cloud Kubernetes Cluster.

Used resources

Kubernetes Provider

  • kubernetes_persistent_volume_claim
  • kubernetes_persistent_volume
  • kubernetes_replication_controller
  • kubernetes_secret
  • kubernetes_service

Prerequsites

Kubernetes

This example expects you to already have a running K8S cluster and credentials set up in a config or environment variables.

If you have it not yet, you can use alibaba cloud kubernetes module to create a new cluster and it can download automatically kube config into a file by setting kube_config, like ~/.kube/config.

How to

Create

First we make sure kubernetes providers is downloaded and available

terraform init

then we carry on by creating the real infrastructure which requires password for the MySQL server.

terraform apply -var 'mysql_password=Test12345'

You may also specify version of WordPress and/or MySQL

terraform apply \
	-var 'mysql_version=5.6' \
	-var 'wordpress_version=4.7.3' \
	-var 'mysql_password=Test12345'

After the apply operation has finished you should see output in your console similar to the one below

...

Outputs:

slb_ip = 35.197.xx.xx

This is the IP address of your public load balancer which exposes the Apache web server serving WordPress. Open that IP in your browser to see the welcome page.

open "http://$(terraform output lb_ip)"

Destroy

terraform destroy -var 'mysql_password=Test12345'

About

Terraform module which deploys Wordpress and MySQL on Alibaba Cloud Kubernetes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL 100.0%