Git Product home page Git Product logo

drupal-on-kubernetes-sample's Introduction

Build Status

Deploy Drupal on Kubernetes

In this Code Pattern, we will setup a Drupal site using Kubernetes and Postgres. Drupal is a popular free and open source content management system used as the backend for millions of web sites worldwide. By splitting out the services into containers, we have the ability to leverage the power of Kubernetes.

When the reader has completed this Code Pattern, they will understand how to:

  • Configure an app running multiple containers in Kubernetes
  • Run a website hosted via Kubernetes
  • Use Kubernetes persistent volumes to maintain Drupal configurations between container restarts

Flow

  1. User interacts with the Drupal web interface.
  2. The Drupal container uses its persistent volume to store website data (but not content).
  3. Drupal container connects to PostgreSQL container to access website content.
  4. PostgreSQL container uses its persistent volume to store the database contents.

Included components

  • Kubernetes Cluster: Create and manage your own cloud infrastructure and use Kubernetes as your container orchestration engine.
  • PostgreSQL: Sophisticated open-source Object-Relational DBMS supporting almost all SQL constructs.

Featured technologies

  • Cloud: Accessing computer and information technology resources through the Internet.

Watch the video

Steps

Deploy to IBM Cloud

Follow these steps to run Drupal on Kubernetes.

  1. Clone the repo
  2. Create Kubernetes cluster
    1. Locally
    2. Hosted on IBM Cloud
  3. Create the service and deployment
  4. Access Drupal

1. Clone the repo

Clone the drupal-on-kubernetes-sample locally. In a terminal, run:

$ git clone https://github.com/IBM/drupal-on-kubernetes-sample

2. Create Kubernetes cluster

Note: Minimum version 1.10 is required for both Kubernetes server and kubectl client.

2.1 Locally

Follow the instructions for running Kubernetes locally via Minikube.

2.2 Hosted on IBM Cloud

Follow the instructions for creating a Kubernetes cluster in IBM Cloud.

3. Create the service and deployment

Either run 'scripts/quickstart.sh', or run the individual commands listed in it:

kubectl create -f kubernetes/local-volumes.yaml
kubectl create -f kubernetes/postgres.yaml
kubectl create -f kubernetes/drupal.yaml

4. Access Drupal

After deploying, we need to be sure that all pods are running. Check on the status via:

kubectl get pods -l app=drupal

Once all pod are running we need to know the IP adress of our Drupal.

If you are running in Minikube, run the following:

$ minikube service drupal --url

If you are running in IBM Cloud, we will need to run the following:

$ bx cs workers "$CLUSTER_NAME"
OK
ID                                                 Public IP        Private IP      Machine Type   State    Status
kube-dal13-cr896f6348d71b4fd1ba151bc7c32abd46-w1   <REDACTED>       10.187.85.198   free           normal   Ready

Access the newly deployed Drupal site via http://<IP_ADDRESS>:30080

Learn more

License

This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

Apache Software License (ASL) FAQ

drupal-on-kubernetes-sample's People

Contributors

anthonyamanse avatar dolph avatar imgbotapp avatar ljbennett62 avatar loafyloaf avatar mlangbehn avatar rvennam avatar stevemar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drupal-on-kubernetes-sample's Issues

pod has unbound immediate PersistentVolumeClaims

kubectl describe pod drupal-649465dd9f-s9cqd
Name:               drupal-649465dd9f-s9cqd
Namespace:          default
Priority:           0
PriorityClassName:  <none>
Node:               <none>
Labels:             app=drupal
                    pod-template-hash=649465dd9f
                    tier=frontend
Annotations:        <none>
Status:             Pending
IP:
Controlled By:      ReplicaSet/drupal-649465dd9f
Containers:
  drupal:
    Image:        drupal:latest
    Port:         30080/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-l2m8k (ro)
      /var/www/html/modules from drupal (rw)
      /var/www/html/profiles from drupal (rw)
      /var/www/html/themes from drupal (rw)
Conditions:
  Type           Status
  PodScheduled   False
Volumes:
  drupal:
    Type:       PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
    ClaimName:  drupal-claim
    ReadOnly:   false
  default-token-l2m8k:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-l2m8k
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                    From               Message
  ----     ------            ----                   ----               -------
  Warning  FailedScheduling  3m28s (x362 over 23m)  default-scheduler  pod has unbound immediate PersistentVolumeClaims (repeated 2 times)

When following instructions to install Drupal:

kubectl create -f kubernetes/local-volumes.yaml
kubectl create -f kubernetes/postgres.yaml
kubectl create -f kubernetes/drupal.yaml

I only changed the size of the Volume to 2Gi instead of 10Gi

version extensions issue.

Whan I try to create, I got following error. Need to change yml file?

$ kubectl create -f kubernetes/postgres.yaml
service/postgresql created
persistentvolumeclaim/postgres-claim created
error: unable to recognize "kubernetes/postgres.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"

Access to Postgres DB

Once the environment is stood up how do I connect and get details for the DB in order to configure Drupal?

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.