Deploy Iron Gallery App on Kubernetes task fails

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:

  1. Create a namespace iron-namespace-xfusion
  2. Create a deployment iron-gallery-deployment-xfusion for iron gallery under the same namespace you created.:- Labels run should be iron-gallery.:- Replicas count should be 1.:- Selector’s matchLabels run should be iron-gallery.:- Template labels run should be iron-gallery under metadata.:- The container should be named as iron-gallery-container-xfusion, use kodekloud/irongallery:2.0 image ( use exact image name / tag ).:- Resources limits for memory should be 100Mi and for CPU should be 50m.:- First volumeMount name should be config, its mountPath should be /usr/share/nginx/html/data.:- Second volumeMount name should be images, its mountPath should be /usr/share/nginx/html/uploads.:- First volume name should be config and give it emptyDir and second volume name should be images, also give it emptyDir.
  3. Create a deployment iron-db-deployment-xfusion for iron db under the same namespace.:- Labels db should be mariadb.:- Replicas count should be 1.:- Selector’s matchLabels db should be mariadb.:- Template labels db should be mariadb under metadata.:- The container name should be iron-db-container-xfusion, use kodekloud/irondb:2.0 image ( use exact image name / tag ).:- Define environment, set MYSQL_DATABASE its value should be database_host, set MYSQL_ROOT_PASSWORD and MYSQL_PASSWORD value should be with some complex passwords for DB connections, and MYSQL_USER value should be any custom user ( except root ).:- Volume mount name should be db and its mountPath should be /var/lib/mysql. Volume name should be db and give it an emptyDir.
  4. Create a service for iron db which should be named iron-db-service-xfusion under the same namespace. Configure spec as selector’s db should be mariadb. Protocol should be TCP, port and targetPort should be 3306 and its type should be ClusterIP.
  5. Create a service for iron gallery which should be named iron-gallery-service-xfusion under the same namespace. Configure spec as selector’s run should be iron-gallery. Protocol should be TCP, port and targetPort should be 80, nodePort should be 32678 and its type should be NodePort.

Note:

  1. 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.
  2. The kubectl on jump_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!

Strange. It looks right, but it is hard to tell. Each time you run the lab you get different namespace and resource names.

I did it just now and it worked.

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    run: iron-gallery
  name: iron-gallery-deployment-datacenter
  namespace: iron-namespace-datacenter
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-datacenter
        resources:
          limits:
            memory: 100Mi
            cpu: 50m
        volumeMounts:
        - name: config
          mountPath: /usr/share/nginx/html/data
        - name: images
          mountPath: /usr/share/nginx/html/uploads
---

apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    db: mariadb
  name: iron-db-deployment-datacenter
  namespace: iron-namespace-datacenter
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-datacenter
        volumeMounts:
        - name: db
          mountPath: /var/lib/mysql
        env:
        - name: MYSQL_DATABASE
          value: database_apache
        - name: MYSQL_ROOT_PASSWORD
          value: sdfgardete
        - name: MYSQL_PASSWORD
          value: x5645uwrtherwyhg
        - name: MYSQL_USER
          value: john
        resources: {}

---

apiVersion: v1
kind: Service
metadata:
  labels:
    run: iron-gallery
  name: iron-db-service-datacenter
  namespace: iron-namespace-datacenter
spec:
  ports:
  - port: 3306
    protocol: TCP
    targetPort: 3306
  selector:
    db: mariadb
  type: ClusterIP

---

apiVersion: v1
kind: Service
metadata:
  creationTimestamp: null
  labels:
    run: iron-gallery
  name: iron-gallery-service-datacenter
  namespace: iron-namespace-datacenter
spec:
  type: NodePort
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
    nodePort: 32678
  selector:
    run: iron-gallery

Thanks @Alistair_KodeKloud.

I tried few times but getting same error, can we mark it as completed? accidently i opted for review and unable to cancel it.

Hi @Hasil,

Please share your review URL here.

Regards,

Hi @Tej-Singh-Rana

Here you go, https://engineer.kodekloud.com/public-review?task_id=64072058741b204d59fbe9fa&user_id=64c0c0850e2142977b5acdcc

Regards,
Hasil

Hi @Hasil,

Please check now. You should see a Start button on this task.

Regards,