Deploy Iron Gallery App on Kubernetes task fails even though final resutls are appaering properly.
Here is the Question,
There is an iron gallery app that the Nautilus DevOps team was developing. They have recently customized the app and are going to deploy the same on the Kubernetes cluster. Below you can find more details:
- Create a namespace
iron-namespace-xfusion
- Create a deployment
iron-gallery-deployment-xfusion
foriron gallery
under the same namespace you created.:- Labelsrun
should beiron-gallery
.:- Replicas count should be1
.:- Selector’s matchLabelsrun
should beiron-gallery
.:- Template labelsrun
should beiron-gallery
under metadata.:- The container should be named asiron-gallery-container-xfusion
, usekodekloud/irongallery:2.0
image ( use exact image name / tag ).:- Resources limits for memory should be100Mi
and for CPU should be50m
.:- First volumeMount name should beconfig
, its mountPath should be/usr/share/nginx/html/data
.:- Second volumeMount name should beimages
, its mountPath should be/usr/share/nginx/html/uploads
.:- First volume name should beconfig
and give itemptyDir
and second volume name should beimages
, also give itemptyDir
. - Create a deployment
iron-db-deployment-xfusion
foriron db
under the same namespace.:- Labelsdb
should bemariadb
.:- Replicas count should be1
.:- Selector’s matchLabelsdb
should bemariadb
.:- Template labelsdb
should bemariadb
under metadata.:- The container name should beiron-db-container-xfusion
, usekodekloud/irondb:2.0
image ( use exact image name / tag ).:- Define environment, setMYSQL_DATABASE
its value should bedatabase_host
, setMYSQL_ROOT_PASSWORD
andMYSQL_PASSWORD
value should be with some complex passwords for DB connections, andMYSQL_USER
value should be any custom user ( except root ).:- Volume mount name should bedb
and its mountPath should be/var/lib/mysql
. Volume name should bedb
and give it anemptyDir
. - Create a service for
iron db
which should be namediron-db-service-xfusion
under the same namespace. Configure spec as selector’s db should bemariadb
. Protocol should beTCP
, port and targetPort should be3306
and its type should beClusterIP
. - Create a service for
iron gallery
which should be namediron-gallery-service-xfusion
under the same namespace. Configure spec as selector’s run should beiron-gallery
. Protocol should beTCP
, port and targetPort should be80
, nodePort should be32678
and its type should beNodePort
.
Note:
- We don’t need to make connection b/w database and front-end now, if the installation page is coming up it should be enough for now.
- The
kubectl
onjump_host
has been configured to work with the kubernetes cluster.
thor@jump_host ~$ k get svc --namespace iron-namespace-xfusion
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
iron-db-service-xfusion ClusterIP 10.96.160.144 <none> 3306/TCP 82s
iron-gallery-service-xfusion NodePort 10.96.64.81 <none> 80:32678/TCP 103s
thor@jump_host ~$ k get pods --namespace iron-namespace-xfusion
NAME READY STATUS RESTARTS AGE
iron-db-deployment-xfusion-b7ddd899-cvxpb 1/1 Running 0 7m22s
iron-gallery-deployment-xfusion-8656b85c65-c8lnl 1/1 Running 0 11m
thor@jump_host ~$ k get deployments.apps --namespace iron-namespace-xfusion
NAME READY UP-TO-DATE AVAILABLE AGE
iron-db-deployment-xfusion 1/1 1 1 7m28s
iron-gallery-deployment-xfusion 1/1 1 1 11m
galley-app
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
run: iron-gallery
name: iron-gallery-deployment-xfusion
namespace: iron-namespace-xfusion
spec:
replicas: 1
selector:
matchLabels:
run: iron-gallery
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
run: iron-gallery
spec:
volumes:
- name: config
emptyDir:
- name: images
emptyDir:
containers:
- image: kodekloud/irongallery:2.0
name: iron-gallery-container-xfusion
resources:
limits:
memory: "100Mi"
cpu: "50m"
volumeMounts:
- mountPath: /usr/share/nginx/html/data
name: config
volumeMounts:
- mountPath: /usr/share/nginx/html/uploads
name: images
status: {}
db
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
db: mariadb
name: iron-db-deployment-xfusion
namespace: iron-namespace-xfusion
spec:
replicas: 1
selector:
matchLabels:
db: mariadb
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
db: mariadb
spec:
volumes:
- name: db
emptyDir:
containers:
- image: kodekloud/irondb:2.0
name: iron-db-container-xfusion
resources: {}
env:
- name: MYSQL_DATABASE
value: database_host
- name: MYSQL_ROOT_PASSWORD
value: R00t@#32
- name: MYSQL_PASSWORD
value: Admin@342
- name: MYSQL_USER
value: admin
volumeMounts:
- mountPath: /var/lib/mysql
name: db
status: {}
Appreciate the help. Thanks!