Skip to content

Latest commit

 

History

History
 
 

kustomize

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Deploy Online Boutique variations with Kustomize

This page contains instructions on deploying variations of the Online Boutique sample application using Kustomize. Each variations is designed as a Kustomize component, so multiple variations can be composed together in the deployment.

What is Kustomize?

Kustomize is a Kubernetes configuration management tool that allows users to customize their manifest configurations without duplication. Its commands are built into kubectl as apply -k. More information on Kustomize can be found on the official Kustomize website.

Prerequisites

You need to have a Kubernetes cluster where you will deploy the Online Boutique's Kubernetes manifests. To set up a GKE (Google Kubernetes Engine) cluster, you can follow the instruction in the root /README.md.

Deploy Online Boutique with Kustomize

  1. From the root folder of this repository, navigate to the kustomize/ directory.

    cd kustomize/
    
  2. See what the default Kustomize configuration defined by kustomize/kustomization.yaml will generate (without actually deploying them yet).

    kubectl kustomize .
    
  3. Apply the default Kustomize configuration (kustomize/kustomization.yaml).

    kubectl apply -k .
    
  4. Wait for all Pods to show STATUS of Running.

    kubectl get pods
    

    The output should be similar to the following:

    NAME                                     READY   STATUS    RESTARTS   AGE
    adservice-76bdd69666-ckc5j               1/1     Running   0          2m58s
    cartservice-66d497c6b7-dp5jr             1/1     Running   0          2m59s
    checkoutservice-666c784bd6-4jd22         1/1     Running   0          3m1s
    currencyservice-5d5d496984-4jmd7         1/1     Running   0          2m59s
    emailservice-667457d9d6-75jcq            1/1     Running   0          3m2s
    frontend-6b8d69b9fb-wjqdg                1/1     Running   0          3m1s
    loadgenerator-665b5cd444-gwqdq           1/1     Running   0          3m
    paymentservice-68596d6dd6-bf6bv          1/1     Running   0          3m
    productcatalogservice-557d474574-888kr   1/1     Running   0          3m
    recommendationservice-69c56b74d4-7z8r5   1/1     Running   0          3m1s
    shippingservice-6ccc89f8fd-v686r         1/1     Running   0          2m58s
    

    Note: It may take 2-3 minutes before the changes are reflected on the deployment.

  5. Access the web frontend in a browser using the frontend's EXTERNAL_IP.

    kubectl get service frontend-external | awk '{print $4}'
    

    Note: you may see <pending> while GCP provisions the load balancer. If this happens, wait a few minutes and re-run the command.

Deploy Online Boutique variations with Kustomize

Here is the list of the variations available as Kustomize components that you could leverage:

Select variations

To customize Online Boutique with its variations, you need to update the default kustomize/kustomization.yaml file. You could do that manually, use sed, or use the kustomize edit command like illustrated below.

Use kustomize edit to select variations

Here is an example with the Cymbal Shops Branding variation, from the kustomize/ folder, run the command below:

kustomize edit add component components/cymbal-branding

You could now combine it with other variations, like for example with the Google Cloud Operations variation:

kustomize edit add component components/google-cloud-operations

Deploy selected variations

Like explained earlier, you can locally render these manifests by running kubectl kustomize . as well as deploying them by running kubectl apply -k ..

So for example, the associated kustomization.yaml could look like:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- base
components:
- components/cymbal-branding
- components/google-cloud-operations

Use remote Kustomize targets

Kustomize allows you to reference public remote resources so the kustomization.yaml could look like:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- github.com/GoogleCloudPlatform/microservices-demo/kustomize/base
components:
- github.com/GoogleCloudPlatform/microservices-demo/kustomize/components/cymbal-branding
- github.com/GoogleCloudPlatform/microservices-demo/kustomize/components/google-cloud-operations

Learn more about Kustomize remote targets.