Book Image

Introduction to DevOps with Kubernetes

By : Onur Yılmaz, Süleyman Akba≈ü
Book Image

Introduction to DevOps with Kubernetes

By: Onur Yılmaz, Süleyman Akba≈ü

Overview of this book

Kubernetes and DevOps are the two pillars that can keep your business at the top by ensuring high performance of your IT infrastructure. Introduction to DevOps with Kubernetes will help you develop the skills you need to improve your DevOps with the power of Kubernetes. The book begins with an overview of Kubernetes primitives and DevOps concepts. You'll understand how Kubernetes can assist you with overcoming a wide range of real-world operation challenges. You will get to grips with creating and upgrading a cluster, and then learn how to deploy, update, and scale an application on Kubernetes. As you advance through the chapters, you’ll be able to monitor an application by setting up a pod failure alert on Prometheus. The book will also guide you in configuring Alertmanager to send alerts to the Slack channel and trace down a problem on the application using kubectl commands. By the end of this book, you’ll be able to manage the lifecycle of simple to complex applications on Kubernetes with confidence.
Table of Contents (11 chapters)

Chapter 2: Introduction to Microservices and Containers

Activity 2: Installing a WordPress Blog and Database Using Docker

Solution:

Perform the following steps to complete this activity:

  1. Create a folder named data. This folder will keep the stateful state of the database in the next steps:
    mkdir data
  2. Start a MySQL container using the official Docker image and the following specifications:

    Use the data folder from Step 1 as the database file. Publish port 3306 to the local system. Set the MYSQL_ROOT_PASSWORD environment variable as rootPassword. Set the MYSQL_DATABASE environment variable as database. Set the MYSQL_USER environment variable as user. Set the MYSQL_PASSWORD environment variable as password. Use mysql as the name of the container. Use the mysql:5.7 container image:

    docker run \
    -v ${PWD} /data/:/var/lib/mysql \
    -p 3306:3306 \
    -e MYSQL_ROOT_PASSWORD=rootPassword \
    -e MYSQL_DATABASE=database \
    -e MYSQL_USER=user \
    -e MYSQL_PASSWORD=password \
    --name mysql...