Giter Site home page Giter Site logo

blog-sample's Introduction

Wordpress Blog

A wordpress blog sample and deploy to kubernetes.

Prerequisites

Please install this dependency below, i'm using macOS as my workstation.

Prepare GKE Cluster

Service Account

I'am using spessific account to deploy the cluster. To create the service account, from google cloud console, choose IAM & Admin > Service Accounts, and click Create Service Account. Name the service account terraform and assign it the Project Editor role. Download a JSON file and put it to file gke-cluster/credential/account.json.

I am using terraform to build the GKE Cluster. From gke-cluster directory, you can follow this step:

  • Make sure change the project name in file main.tf to your project name
provider "google" {
  credentials = "${file("./credential/account.json")}"
  project     = "<your project name>"
  region      = "asia-southeast1"
}
  • Initialize the terraform, download and install all dependency
terraform init
  • Review the execution plan
terraform plan
  • Build the GKE Cluster
terraform apply

You need to waiting until terraform finish to build the cluster, it give the progress log output. After the cluster created, you can access and get the config to your kubeconfig.

  • Get the cluster list on your GKE
gcloud container clusters list
  • Get your cluster credential (in my case, the cluster name is gke-cluster). Kubeconfig entry will add to your kubectl config automatically
gcloud container clusters get-credentials gke-cluster --zone=asia-southeast1-a

Until this step, the cluster shoud be ready and you can verify by execute kubectl cluster-info

Because we're deploying the wordpress blog using helm, we need to deploy tiller to the kubernetes cluster with this step:

  • Create tiller service account that will used by tiller
kubectl create -f tiller.yaml
  • Deploy tiller with spessific service account
helm init --service-account tiller 

Deploy Blog

To deploy the blog, execute this command:

./blog.sh deploy

Scale Up Blog

To scale the blog, execute this command:

./blog.sh scale <number of replica>

Delete Up Blog

To scale the blog, execute this command:

./blog.sh delete

blog-sample's People

Contributors

phoipet avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.