SlideShare a Scribd company logo
Red Hat OpenShift Workshop
Deploy MySQL and Wordpress on CodeReady Containers
Mihai Criveti, Cloud Native Solutioning Leader, RHCE
November 23, 2020
1
OpenShift Workshop
CodeReady Containers
Project Configuration
Deploy MySQL
Wordpress
Scaling Applications
Next Steps
2
OpenShift Workshop
Scenario Overview
Figure 1: WordPress and MySQL on OpenShift
3
Steps
0. Test MySQL + Wordpress using podman.
1. Install CodeReady Containers
2. Create a project called wordpress
3. Create users and groups and setup htpassword authentication
• User admin as cluster admin
• developers:developer as edit for project
• leaders:leader as self-provisioner group
• testers:tester as view for project
4. Deploy mysql from registry.redhat.io/rhel8/mysql-80 and configure the secret
5. Deploy wordpress from docker.io/library/wordpress:5.5.0-php7.2-apache
6. Create a route and test wordpress
7. Scale
8. Setup probes and monitoring
4
Resources
• https://hub.docker.com/_/wordpress
• https://catalog.redhat.com/software/containers/rhel8/mysql-80/5ba0ad4cdd19c70b45cbf48c?container-
tabs=gti&gti-tabs=registry-tokens
5
CodeReady Containers
Install CodeReady Containers
Download CodeReady Containers
Go to http://cloud.redhat.com and download CodeReady Containers and the Pull Secret.
Unpack the archive
tar Jxf crc-linux-amd64.tar.xz
cd crc-linux-1.14.0-amd64
Setup CRC
./crc setup
./crc config set memory 16536
./crc config set cpus 8
./crc start
6
Deleting and Recreating your CRC
./crc stop
./crc delete
7
Connect to OCP
Setup the environment and autocomplete
eval $(./crc oc-env)
source <(oc completion zsh)
export API=https://api.crc.testing:6443
Get console info and login
./crc console --credentials
./crc console
export KUBEPASS=abcd
oc login -u kubeadmin -p $KUBEPASS $API
oc whoami; oc whoami --show-server
8
Setup users and OAuth
Create a random user password
export PASS=$(openssl rand -hex 15)
echo $PASS > password
Create users using htpasswd
yum provides htpasswd; sudo dnf install httpd-tools
htpasswd -c -b -B htpass-secret admin $PASS
htpasswd -b -B htpass-secret developer $PASS
htpasswd -b -B htpass-secret leader $PASS
htpasswd -b -B htpass-secret tester $PASS
cat htpass-secret
9
Setup secrets
Create OpenShift secrets in the openshift-config namespace
oc get secret/htpass-secret -n openshift-config
oc create secret generic htpass-secret -o yaml -n openshift-config 
--from-file=htpasswd=htpass-secret --dry-run | oc create -f -
oc create secret generic htpass-secret -o yaml -n openshift-config 
--from-file=htpasswd=htpass-secret --dry-run | oc replace -f -
oc extract secret/htpass-secret -n openshift-config --to - 
| tee htpass-secret
10
Setup cluster OAuth
Get oauth to edit
oc get oauth cluster -o yaml | tee oauth.yaml
11
Setup identityProviders
Edit oauth.yaml
spec:
identityProviders:
- htpasswd:
fileData:
name: htpass-secret
mappingMethod: claim
name: htpasswd_provider
type: HTPasswd
Apply
oc replace -f oauth.yaml
12
Setup cluster admin
Give the admin user cluster-admin permissions
oc adm policy add-cluster-role-to-user cluster-admin admin
Login as admin
oc login -u admin -p $PASS
oc login -u admin -p $PASS --loglevel 10 $API
oc whoami
13
Setup groups
Create groups
oc adm groups new leaders
oc adm groups new developers
oc adm groups new testers
oc get groups
Setup groups users
oc adm groups add-users leaders leader
oc adm groups add-users developers developer
oc adm groups add-users testers tester
oc get groups
14
Setup self-provisioning
Disable self-provisioning for all users
oc api-resources | grep rbac
oc get clusterrolebindings | grep self
oc describe clusterrolebindings self-provisioner
oc adm policy remove-cluster-role-from-group 
self-provisioner system:authenticated:oauth
Leaders can create projects
oc adm policy add-cluster-role-to-group self-provisioner leaders
15
Project Configuration
Create a project and setup policies
Create a new project and assign to developer
oc login -u leader -p $PASS $API
oc new-project wordpress
oc adm policy add-role-to-group edit developers
oc adm policy add-role-to-group view testers
oc login -u developer -p $PASS
16
Setup Quotas
oc create --save-config dev-quota.yaml
# or
oc create quota dev-quota --hard services=10,cpu=1300,memory=2Gi
oc get resource quota
oc describe quota
17
Deploy MySQL
Create a project and setup policies
Create a new project and assign to developer
oc login -u leader -p $PASS $API
oc new-project wordpress
oc adm policy add-role-to-group edit developers
oc adm policy add-role-to-group view testers
oc login -u developer -p $PASS
18
Deploy MySQL
Create a mysql secret
oc create secret generic mysql 
--from-literal database=wordpress 
--from-literal user=wpuser 
--from-literal password=password
Deploy MySQL from Red Hat
oc new-app --name mysql 
--docker-image=registry.redhat.io/rhel8/mysql-80 
--as-deployment-config=true
Check status - env is not yet set, app will crash
oc get dc,pod
oc status
oc logs pod/mysql-1-xxxxx
19
Configure my.cnf with ConfigMaps
Create a my.cnf file from the existing one
oc rsh mysql-2-hcstt cat /etc/my.cnf > my.cnf
echo 'default-authentication-plugin=mysql_native_password' >> my.cnf
Create a configmap
oc create configmap mysql-config --from-file my.cnf
oc set volume dc/mysql --add --name mysql-config --overwrite 
--type=configmap --configmap-name=mysql-config 
--mount-path=/etc/mysql-config
Check the settings
oc describe configmaps mysql-config
oc set volume dc --all
oc get all -l app=mysql
20
Configure the environment to use secrets
Set the environment to use the secret and config file
oc set env dc/mysql --from=secret/mysql 
--prefix=MYSQL_ DEFAULTS_FILE=/etc/mysql-config/my.cnf
oc set env pods --all --list
Get status
oc get dc,pod
oc status
oc logs pod/mysql-3-deploy
oc logs pod/mysql-3-xxxx
oc get all -l app=mysql
21
Test your database
Log into your container using oc rsh
oc rsh mysql-2-xxxxx
mysql -u wpuser --password=password wordpress -e 'show databases;'
exit
22
Wordpress
Deploy the Wordpress Pods
Deploy wordpress
oc new-app --name wordpress 
--docker-image docker.io/library/wordpress:5.5.0-php7.2-apache 
-e WORDPRESS_DB_HOST=mysql 
-e WORDPRESS_DB_NAME=wordpress 
-e WORDPRESS_DB_USER=wpuser 
-e WORDPRESS_DB_PASSWORD=password 
--as-deployment-config=true
Get status
oc get pod
oc logs pod/wordpress-1-7kf49
23
Create a service account
Create a service account
oc login -u admin -p $PASS
oc create sa wordpress-sa
oc adm policy add-scc-to-user anyuid -z wordpress-sa
Set wordpress-sa for the deploymentconfig
oc login -u developer -p $PASS
oc set serviceaccount deploymentconfig wordpress wordpress-sa
Get the status
oc get all
oc get events
oc logs pod/wordpress-2-468kp
24
Expose the application
Create a route
oc expose svc/wordpress
oc get routes
Setup WordPress
Go to http://wordpress-wordpress.apps-crc.testing/ to setup WordPress.
25
Cleanup
Deleting individual apps
oc delete all -l app=wordpress
oc delete all -l app=mysql
Deleting the entire project
oc delete projects wordpress
26
Debugging
Debug a deployment as root to check for permissions
oc debug -t deployment/wordpress --as-root
Replace the image
oc debug -t deployment/mysql 
--image registry.access.redehat.com/ubi/ubi:8.0
27
Scaling Applications
Manual Scaling
Get the dc
oc get dc
NAME REVISION DESIRED CURRENT
mysql 5 1 1
wordpress 2 1 1
Scale the dc
oc scale dc wordpress --replicas=3
oc get dc,pod
28
Create a PostgreSQL Operator using CLI
Operators
• MariaDB ?
• PostgreSQL
29
Next Steps
Next Steps
1. Add Health Checks
2. Scale up the application
3. Set up auto-scaling
4. Use a MySQL Operator to manage the database instead.
30

More Related Content

What's hot

SeaweedFS introduction
SeaweedFS introductionSeaweedFS introduction
SeaweedFS introduction
chrislusf
 
Paul Angus – Backup & Recovery in CloudStack
Paul Angus – Backup & Recovery in CloudStackPaul Angus – Backup & Recovery in CloudStack
Paul Angus – Backup & Recovery in CloudStack
ShapeBlue
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software Test
I Goo Lee
 
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
Ji-Woong Choi
 
ProxySQL Cluster - Percona Live 2022
ProxySQL Cluster - Percona Live 2022ProxySQL Cluster - Percona Live 2022
ProxySQL Cluster - Percona Live 2022
René Cannaò
 
Azure AWS real time-interview questions part 9
Azure AWS real time-interview questions part 9Azure AWS real time-interview questions part 9
Azure AWS real time-interview questions part 9
Malleswar Reddy
 
ProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management OverviewProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management Overview
René Cannaò
 
github actions kubernetes 설치&운영하기
github actions kubernetes 설치&운영하기github actions kubernetes 설치&운영하기
github actions kubernetes 설치&운영하기
newdeal2
 
AWS X-Ray를 통한 서버리스 분산 애플리케이션 추적하기 - 윤석찬 (AWS 테크에반젤리스트)
AWS X-Ray를 통한 서버리스 분산 애플리케이션 추적하기 - 윤석찬 (AWS 테크에반젤리스트)AWS X-Ray를 통한 서버리스 분산 애플리케이션 추적하기 - 윤석찬 (AWS 테크에반젤리스트)
AWS X-Ray를 통한 서버리스 분산 애플리케이션 추적하기 - 윤석찬 (AWS 테크에반젤리스트)
Amazon Web Services Korea
 
Kafka Tutorial: Kafka Security
Kafka Tutorial: Kafka SecurityKafka Tutorial: Kafka Security
Kafka Tutorial: Kafka Security
Jean-Paul Azar
 
nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제
choi sungwook
 
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
OpenStack Korea Community
 
ProxySQL for MySQL
ProxySQL for MySQLProxySQL for MySQL
ProxySQL for MySQL
Mydbops
 
MySQL_MariaDB로의_전환_기술요소-202212.pptx
MySQL_MariaDB로의_전환_기술요소-202212.pptxMySQL_MariaDB로의_전환_기술요소-202212.pptx
MySQL_MariaDB로의_전환_기술요소-202212.pptx
NeoClova
 
Airbnb's Journey from Self-Managed Redis to ElastiCache for Redis (DAT319) - ...
Airbnb's Journey from Self-Managed Redis to ElastiCache for Redis (DAT319) - ...Airbnb's Journey from Self-Managed Redis to ElastiCache for Redis (DAT319) - ...
Airbnb's Journey from Self-Managed Redis to ElastiCache for Redis (DAT319) - ...
Amazon Web Services
 
Road to serverless
Road to serverlessRoad to serverless
Road to serverless
Matheus Fidelis
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험
NHN FORWARD
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera ClusterAbdul Manaf
 
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Simplilearn
 
Cloud Native Days Korea 2019 - kakao's k8s_as_a_service
Cloud Native Days Korea 2019 - kakao's k8s_as_a_serviceCloud Native Days Korea 2019 - kakao's k8s_as_a_service
Cloud Native Days Korea 2019 - kakao's k8s_as_a_service
Dennis Hong
 

What's hot (20)

SeaweedFS introduction
SeaweedFS introductionSeaweedFS introduction
SeaweedFS introduction
 
Paul Angus – Backup & Recovery in CloudStack
Paul Angus – Backup & Recovery in CloudStackPaul Angus – Backup & Recovery in CloudStack
Paul Angus – Backup & Recovery in CloudStack
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software Test
 
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
[오픈소스컨설팅]쿠버네티스를 활용한 개발환경 구축
 
ProxySQL Cluster - Percona Live 2022
ProxySQL Cluster - Percona Live 2022ProxySQL Cluster - Percona Live 2022
ProxySQL Cluster - Percona Live 2022
 
Azure AWS real time-interview questions part 9
Azure AWS real time-interview questions part 9Azure AWS real time-interview questions part 9
Azure AWS real time-interview questions part 9
 
ProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management OverviewProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management Overview
 
github actions kubernetes 설치&운영하기
github actions kubernetes 설치&운영하기github actions kubernetes 설치&운영하기
github actions kubernetes 설치&운영하기
 
AWS X-Ray를 통한 서버리스 분산 애플리케이션 추적하기 - 윤석찬 (AWS 테크에반젤리스트)
AWS X-Ray를 통한 서버리스 분산 애플리케이션 추적하기 - 윤석찬 (AWS 테크에반젤리스트)AWS X-Ray를 통한 서버리스 분산 애플리케이션 추적하기 - 윤석찬 (AWS 테크에반젤리스트)
AWS X-Ray를 통한 서버리스 분산 애플리케이션 추적하기 - 윤석찬 (AWS 테크에반젤리스트)
 
Kafka Tutorial: Kafka Security
Kafka Tutorial: Kafka SecurityKafka Tutorial: Kafka Security
Kafka Tutorial: Kafka Security
 
nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제nexus helm 설치, docker/helm repo 설정과 예제
nexus helm 설치, docker/helm repo 설정과 예제
 
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
[OpenInfra Days Korea 2018] (Track 4) - FreeIPA와 함께 SSO 구성
 
ProxySQL for MySQL
ProxySQL for MySQLProxySQL for MySQL
ProxySQL for MySQL
 
MySQL_MariaDB로의_전환_기술요소-202212.pptx
MySQL_MariaDB로의_전환_기술요소-202212.pptxMySQL_MariaDB로의_전환_기술요소-202212.pptx
MySQL_MariaDB로의_전환_기술요소-202212.pptx
 
Airbnb's Journey from Self-Managed Redis to ElastiCache for Redis (DAT319) - ...
Airbnb's Journey from Self-Managed Redis to ElastiCache for Redis (DAT319) - ...Airbnb's Journey from Self-Managed Redis to ElastiCache for Redis (DAT319) - ...
Airbnb's Journey from Self-Managed Redis to ElastiCache for Redis (DAT319) - ...
 
Road to serverless
Road to serverlessRoad to serverless
Road to serverless
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험
 
MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera Cluster
 
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
 
Cloud Native Days Korea 2019 - kakao's k8s_as_a_service
Cloud Native Days Korea 2019 - kakao's k8s_as_a_serviceCloud Native Days Korea 2019 - kakao's k8s_as_a_service
Cloud Native Days Korea 2019 - kakao's k8s_as_a_service
 

Similar to Kubernetes Story - Day 3: Deploying and Scaling Applications on OpenShift

[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
Alessandro Arrichiello
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
Ben Hall
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
Sysdig
 
Simple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE LabSimple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE Lab
Fernando Lopez Aguilar
 
Software Defined Datacenter
Software Defined DatacenterSoftware Defined Datacenter
Software Defined Datacenter
NETWAYS
 
Intalacion de owncloud
Intalacion de owncloudIntalacion de owncloud
Intalacion de owncloud
Fredy Ntn Bautista
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
Diana Thompson
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
msyukor
 
Introduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineIntroduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command line
Behzod Saidov
 
Enrique lima azure-it-pro-ps
Enrique lima azure-it-pro-psEnrique lima azure-it-pro-ps
Enrique lima azure-it-pro-ps
Enrique Lima
 
Kubernetes Story - Day 1: Build and Manage Containers with Podman
Kubernetes Story - Day 1: Build and Manage Containers with PodmanKubernetes Story - Day 1: Build and Manage Containers with Podman
Kubernetes Story - Day 1: Build and Manage Containers with Podman
Mihai Criveti
 
Automated Server Administration for DevSecOps
Automated Server Administration for DevSecOpsAutomated Server Administration for DevSecOps
Automated Server Administration for DevSecOps
Aarno Aukia
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
Diana Thompson
 
Introduction To Managing VMware With PowerShell
Introduction To Managing VMware With PowerShellIntroduction To Managing VMware With PowerShell
Introduction To Managing VMware With PowerShell
Hal Rottenberg
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentTakayuki Miyauchi
 
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long BeachTake Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Diana Thompson
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year later
Christian Ortner
 
Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)
Yuriy Senko
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Yiwei Ma
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作
Philip Zheng
 

Similar to Kubernetes Story - Day 3: Deploying and Scaling Applications on OpenShift (20)

[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
Wordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccionWordpress y Docker, de desarrollo a produccion
Wordpress y Docker, de desarrollo a produccion
 
Simple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE LabSimple docker hosting in FIWARE Lab
Simple docker hosting in FIWARE Lab
 
Software Defined Datacenter
Software Defined DatacenterSoftware Defined Datacenter
Software Defined Datacenter
 
Intalacion de owncloud
Intalacion de owncloudIntalacion de owncloud
Intalacion de owncloud
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
Docker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak PeekDocker for Web Developers: A Sneak Peek
Docker for Web Developers: A Sneak Peek
 
Introduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineIntroduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command line
 
Enrique lima azure-it-pro-ps
Enrique lima azure-it-pro-psEnrique lima azure-it-pro-ps
Enrique lima azure-it-pro-ps
 
Kubernetes Story - Day 1: Build and Manage Containers with Podman
Kubernetes Story - Day 1: Build and Manage Containers with PodmanKubernetes Story - Day 1: Build and Manage Containers with Podman
Kubernetes Story - Day 1: Build and Manage Containers with Podman
 
Automated Server Administration for DevSecOps
Automated Server Administration for DevSecOpsAutomated Server Administration for DevSecOps
Automated Server Administration for DevSecOps
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
Introduction To Managing VMware With PowerShell
Introduction To Managing VMware With PowerShellIntroduction To Managing VMware With PowerShell
Introduction To Managing VMware With PowerShell
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environment
 
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long BeachTake Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long Beach
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year later
 
Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)Python from zero to hero (Twitter Explorer)
Python from zero to hero (Twitter Explorer)
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作
 

More from Mihai Criveti

10 Limitations of Large Language Models and Mitigation Options
10 Limitations of Large Language Models and Mitigation Options10 Limitations of Large Language Models and Mitigation Options
10 Limitations of Large Language Models and Mitigation Options
Mihai Criveti
 
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
Mihai Criveti
 
Ansible Workshop for Pythonistas
Ansible Workshop for PythonistasAnsible Workshop for Pythonistas
Ansible Workshop for Pythonistas
Mihai Criveti
 
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate EverythingMihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti
 
Data Science at Scale - The DevOps Approach
Data Science at Scale - The DevOps ApproachData Science at Scale - The DevOps Approach
Data Science at Scale - The DevOps Approach
Mihai Criveti
 
ShipItCon - Continuous Deployment and Multicloud with Ansible and Kubernetes
ShipItCon - Continuous Deployment and Multicloud with Ansible and KubernetesShipItCon - Continuous Deployment and Multicloud with Ansible and Kubernetes
ShipItCon - Continuous Deployment and Multicloud with Ansible and Kubernetes
Mihai Criveti
 
DevOps for Data Engineers - Automate Your Data Science Pipeline with Ansible,...
DevOps for Data Engineers - Automate Your Data Science Pipeline with Ansible,...DevOps for Data Engineers - Automate Your Data Science Pipeline with Ansible,...
DevOps for Data Engineers - Automate Your Data Science Pipeline with Ansible,...
Mihai Criveti
 
OpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image LifecycleOpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image Lifecycle
Mihai Criveti
 
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
Mihai Criveti
 
Container Technologies and Transformational value
Container Technologies and Transformational valueContainer Technologies and Transformational value
Container Technologies and Transformational value
Mihai Criveti
 
OpenShift Commons - Adopting Podman, Skopeo and Buildah for Building and Mana...
OpenShift Commons - Adopting Podman, Skopeo and Buildah for Building and Mana...OpenShift Commons - Adopting Podman, Skopeo and Buildah for Building and Mana...
OpenShift Commons - Adopting Podman, Skopeo and Buildah for Building and Mana...
Mihai Criveti
 
AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...
AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...
AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...
Mihai Criveti
 

More from Mihai Criveti (12)

10 Limitations of Large Language Models and Mitigation Options
10 Limitations of Large Language Models and Mitigation Options10 Limitations of Large Language Models and Mitigation Options
10 Limitations of Large Language Models and Mitigation Options
 
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
Retrieval Augmented Generation in Practice: Scalable GenAI platforms with k8s...
 
Ansible Workshop for Pythonistas
Ansible Workshop for PythonistasAnsible Workshop for Pythonistas
Ansible Workshop for Pythonistas
 
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate EverythingMihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate Everything
 
Data Science at Scale - The DevOps Approach
Data Science at Scale - The DevOps ApproachData Science at Scale - The DevOps Approach
Data Science at Scale - The DevOps Approach
 
ShipItCon - Continuous Deployment and Multicloud with Ansible and Kubernetes
ShipItCon - Continuous Deployment and Multicloud with Ansible and KubernetesShipItCon - Continuous Deployment and Multicloud with Ansible and Kubernetes
ShipItCon - Continuous Deployment and Multicloud with Ansible and Kubernetes
 
DevOps for Data Engineers - Automate Your Data Science Pipeline with Ansible,...
DevOps for Data Engineers - Automate Your Data Science Pipeline with Ansible,...DevOps for Data Engineers - Automate Your Data Science Pipeline with Ansible,...
DevOps for Data Engineers - Automate Your Data Science Pipeline with Ansible,...
 
OpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image LifecycleOpenShift Virtualization - VM and OS Image Lifecycle
OpenShift Virtualization - VM and OS Image Lifecycle
 
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
Kubernetes Story - Day 2: Quay.io Container Registry for Publishing, Building...
 
Container Technologies and Transformational value
Container Technologies and Transformational valueContainer Technologies and Transformational value
Container Technologies and Transformational value
 
OpenShift Commons - Adopting Podman, Skopeo and Buildah for Building and Mana...
OpenShift Commons - Adopting Podman, Skopeo and Buildah for Building and Mana...OpenShift Commons - Adopting Podman, Skopeo and Buildah for Building and Mana...
OpenShift Commons - Adopting Podman, Skopeo and Buildah for Building and Mana...
 
AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...
AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...
AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...
 

Recently uploaded

AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 

Recently uploaded (20)

AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 

Kubernetes Story - Day 3: Deploying and Scaling Applications on OpenShift

  • 1. Red Hat OpenShift Workshop Deploy MySQL and Wordpress on CodeReady Containers Mihai Criveti, Cloud Native Solutioning Leader, RHCE November 23, 2020 1
  • 2. OpenShift Workshop CodeReady Containers Project Configuration Deploy MySQL Wordpress Scaling Applications Next Steps 2
  • 4. Scenario Overview Figure 1: WordPress and MySQL on OpenShift 3
  • 5. Steps 0. Test MySQL + Wordpress using podman. 1. Install CodeReady Containers 2. Create a project called wordpress 3. Create users and groups and setup htpassword authentication • User admin as cluster admin • developers:developer as edit for project • leaders:leader as self-provisioner group • testers:tester as view for project 4. Deploy mysql from registry.redhat.io/rhel8/mysql-80 and configure the secret 5. Deploy wordpress from docker.io/library/wordpress:5.5.0-php7.2-apache 6. Create a route and test wordpress 7. Scale 8. Setup probes and monitoring 4
  • 8. Install CodeReady Containers Download CodeReady Containers Go to http://cloud.redhat.com and download CodeReady Containers and the Pull Secret. Unpack the archive tar Jxf crc-linux-amd64.tar.xz cd crc-linux-1.14.0-amd64 Setup CRC ./crc setup ./crc config set memory 16536 ./crc config set cpus 8 ./crc start 6
  • 9. Deleting and Recreating your CRC ./crc stop ./crc delete 7
  • 10. Connect to OCP Setup the environment and autocomplete eval $(./crc oc-env) source <(oc completion zsh) export API=https://api.crc.testing:6443 Get console info and login ./crc console --credentials ./crc console export KUBEPASS=abcd oc login -u kubeadmin -p $KUBEPASS $API oc whoami; oc whoami --show-server 8
  • 11. Setup users and OAuth Create a random user password export PASS=$(openssl rand -hex 15) echo $PASS > password Create users using htpasswd yum provides htpasswd; sudo dnf install httpd-tools htpasswd -c -b -B htpass-secret admin $PASS htpasswd -b -B htpass-secret developer $PASS htpasswd -b -B htpass-secret leader $PASS htpasswd -b -B htpass-secret tester $PASS cat htpass-secret 9
  • 12. Setup secrets Create OpenShift secrets in the openshift-config namespace oc get secret/htpass-secret -n openshift-config oc create secret generic htpass-secret -o yaml -n openshift-config --from-file=htpasswd=htpass-secret --dry-run | oc create -f - oc create secret generic htpass-secret -o yaml -n openshift-config --from-file=htpasswd=htpass-secret --dry-run | oc replace -f - oc extract secret/htpass-secret -n openshift-config --to - | tee htpass-secret 10
  • 13. Setup cluster OAuth Get oauth to edit oc get oauth cluster -o yaml | tee oauth.yaml 11
  • 14. Setup identityProviders Edit oauth.yaml spec: identityProviders: - htpasswd: fileData: name: htpass-secret mappingMethod: claim name: htpasswd_provider type: HTPasswd Apply oc replace -f oauth.yaml 12
  • 15. Setup cluster admin Give the admin user cluster-admin permissions oc adm policy add-cluster-role-to-user cluster-admin admin Login as admin oc login -u admin -p $PASS oc login -u admin -p $PASS --loglevel 10 $API oc whoami 13
  • 16. Setup groups Create groups oc adm groups new leaders oc adm groups new developers oc adm groups new testers oc get groups Setup groups users oc adm groups add-users leaders leader oc adm groups add-users developers developer oc adm groups add-users testers tester oc get groups 14
  • 17. Setup self-provisioning Disable self-provisioning for all users oc api-resources | grep rbac oc get clusterrolebindings | grep self oc describe clusterrolebindings self-provisioner oc adm policy remove-cluster-role-from-group self-provisioner system:authenticated:oauth Leaders can create projects oc adm policy add-cluster-role-to-group self-provisioner leaders 15
  • 19. Create a project and setup policies Create a new project and assign to developer oc login -u leader -p $PASS $API oc new-project wordpress oc adm policy add-role-to-group edit developers oc adm policy add-role-to-group view testers oc login -u developer -p $PASS 16
  • 20. Setup Quotas oc create --save-config dev-quota.yaml # or oc create quota dev-quota --hard services=10,cpu=1300,memory=2Gi oc get resource quota oc describe quota 17
  • 22. Create a project and setup policies Create a new project and assign to developer oc login -u leader -p $PASS $API oc new-project wordpress oc adm policy add-role-to-group edit developers oc adm policy add-role-to-group view testers oc login -u developer -p $PASS 18
  • 23. Deploy MySQL Create a mysql secret oc create secret generic mysql --from-literal database=wordpress --from-literal user=wpuser --from-literal password=password Deploy MySQL from Red Hat oc new-app --name mysql --docker-image=registry.redhat.io/rhel8/mysql-80 --as-deployment-config=true Check status - env is not yet set, app will crash oc get dc,pod oc status oc logs pod/mysql-1-xxxxx 19
  • 24. Configure my.cnf with ConfigMaps Create a my.cnf file from the existing one oc rsh mysql-2-hcstt cat /etc/my.cnf > my.cnf echo 'default-authentication-plugin=mysql_native_password' >> my.cnf Create a configmap oc create configmap mysql-config --from-file my.cnf oc set volume dc/mysql --add --name mysql-config --overwrite --type=configmap --configmap-name=mysql-config --mount-path=/etc/mysql-config Check the settings oc describe configmaps mysql-config oc set volume dc --all oc get all -l app=mysql 20
  • 25. Configure the environment to use secrets Set the environment to use the secret and config file oc set env dc/mysql --from=secret/mysql --prefix=MYSQL_ DEFAULTS_FILE=/etc/mysql-config/my.cnf oc set env pods --all --list Get status oc get dc,pod oc status oc logs pod/mysql-3-deploy oc logs pod/mysql-3-xxxx oc get all -l app=mysql 21
  • 26. Test your database Log into your container using oc rsh oc rsh mysql-2-xxxxx mysql -u wpuser --password=password wordpress -e 'show databases;' exit 22
  • 28. Deploy the Wordpress Pods Deploy wordpress oc new-app --name wordpress --docker-image docker.io/library/wordpress:5.5.0-php7.2-apache -e WORDPRESS_DB_HOST=mysql -e WORDPRESS_DB_NAME=wordpress -e WORDPRESS_DB_USER=wpuser -e WORDPRESS_DB_PASSWORD=password --as-deployment-config=true Get status oc get pod oc logs pod/wordpress-1-7kf49 23
  • 29. Create a service account Create a service account oc login -u admin -p $PASS oc create sa wordpress-sa oc adm policy add-scc-to-user anyuid -z wordpress-sa Set wordpress-sa for the deploymentconfig oc login -u developer -p $PASS oc set serviceaccount deploymentconfig wordpress wordpress-sa Get the status oc get all oc get events oc logs pod/wordpress-2-468kp 24
  • 30. Expose the application Create a route oc expose svc/wordpress oc get routes Setup WordPress Go to http://wordpress-wordpress.apps-crc.testing/ to setup WordPress. 25
  • 31. Cleanup Deleting individual apps oc delete all -l app=wordpress oc delete all -l app=mysql Deleting the entire project oc delete projects wordpress 26
  • 32. Debugging Debug a deployment as root to check for permissions oc debug -t deployment/wordpress --as-root Replace the image oc debug -t deployment/mysql --image registry.access.redehat.com/ubi/ubi:8.0 27
  • 34. Manual Scaling Get the dc oc get dc NAME REVISION DESIRED CURRENT mysql 5 1 1 wordpress 2 1 1 Scale the dc oc scale dc wordpress --replicas=3 oc get dc,pod 28
  • 35. Create a PostgreSQL Operator using CLI Operators • MariaDB ? • PostgreSQL 29
  • 37. Next Steps 1. Add Health Checks 2. Scale up the application 3. Set up auto-scaling 4. Use a MySQL Operator to manage the database instead. 30