Closed hardy30894 closed 1 year ago
The wishlist app is deployed to IBM cloud at 159.122.183.157:31000
vscode@nyu:/app$ wget -O - 159.122.183.157:31000 | jq .
--2022-11-16 00:15:23-- http://159.122.183.157:31000/
Connecting to 159.122.183.157:31000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1339 (1.3K) [application/json]
Saving to: ‘STDOUT’
100%[===========================================>] 1.31K --.-KB/s in 0s
2022-11-16 00:15:23 (119 MB/s) - written to stdout [1339/1339]
Steps to deploy the app to IBM cloud:
nyu-devops
using IBM Cloud UI~/.blumix/apikey.json
in your local machinedocker exec -it -u vscode nyu bash
/app
in the container. Execute make login
to login into IBM cloud. This step uses the apikey.json we downloaded earlier in step#3nyu-devops-wishlist
as a part of this issue.make build
to create a new Docker imagedocker image ls
ibmcloud cr images
docker push docker push us.icr.io/nyu-devops-wishlist/wishlist:1.0
. Note that we have hard-coded version 1.0 for now.wishlist app
, postgres app
, and required services via the command kc apply -f deploy
kc get all
. Wait for the status of pods to change to READY.ic ks workers --cluster nyu-devops
Helpful outputs:
vscode@nyu:/app$ kc get all
NAME READY STATUS RESTARTS AGE
pod/postgres-0 1/1 Running 0 3m7s
pod/wishlist-5c54dd8f6-c4z9m 1/1 Running 0 3m7s
pod/wishlist-5c54dd8f6-l5r2v 1/1 Running 0 3m7s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 172.21.0.1 <none> 443/TCP 45h
service/postgres NodePort 172.21.23.95 <none> 5432:31032/TCP 3m7s
service/wishlist NodePort 172.21.7.36 <none> 8080:31000/TCP 3m6s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/wishlist 2/2 2 2 3m8s
NAME DESIRED CURRENT READY AGE
replicaset.apps/wishlist-5c54dd8f6 2 2 2 3m8s
NAME READY AGE
statefulset.apps/postgres 1/1 3m9s
vscode@nyu:/app$ ibmcloud ks workers --cluster nyu-devops
OK
ID Public IP Private IP Flavor State Status Zone Version
kube-cdoqj2rf0c3a4teg0qsg-nyudevops-default-000000a9 159.122.183.157 10.144.186.217 free normal Ready mil01 1.24.7_1543
vscode@nyu:/app$ kc delete -f deploy/
deployment.apps "wishlist" deleted
statefulset.apps "postgres" deleted
service "postgres" deleted
secret "postgres-creds" deleted
service "wishlist" deleted
vscode@nyu:/app$ kc apply -f deploy/
deployment.apps/wishlist created
statefulset.apps/postgres created
service/postgres created
secret/postgres-creds created
service/wishlist created
vscode@nyu:/app$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
us.icr.io/nyu-devops-wishlist/wishlist 1.0 846c1607db81 2 hours ago 388MB
vscode@nyu:/app$ make login
Logging into IBM Cloud cluster nyu-devops...
ibmcloud login -a cloud.ibm.com -g Default -r us-south --apikey @~/apikey.json
API endpoint: https://cloud.ibm.com
Authenticating...
OK
Targeted account Saim Raza's Account (<SNIP>)
Targeted resource group Default
Targeted region us-south
API endpoint: https://cloud.ibm.com
Region: us-south
User: sr5542@nyu.edu
Account: Saim Raza's Account (<SNIP>)
Resource group: Default
CF API endpoint:
Org:
Space:
ibmcloud cr login
Logging 'docker' in to 'us.icr.io'...
Logged in to 'us.icr.io'.
OK
ibmcloud ks cluster config --cluster nyu-devops
OK
The configuration for nyu-devops was downloaded successfully.
Added context for nyu-devops to the current kubeconfig file.
You can now execute 'kubectl' commands against your cluster. For example, run 'kubectl get nodes'.
If you are accessing the cluster for the first time, 'kubectl' commands might fail for a few seconds while RBAC synchronizes.
kubectl cluster-info
Kubernetes control plane is running at https://c108.eu-de.containers.cloud.ibm.com:32287
CoreDNS is running at https://c108.eu-de.containers.cloud.ibm.com:32287/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
kubernetes-dashboard is running at https://c108.eu-de.containers.cloud.ibm.com:32287/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy
Metrics-server is running at https://c108.eu-de.containers.cloud.ibm.com:32287/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy
NodeLocalDNS is running at https://c108.eu-de.containers.cloud.ibm.com:32287/api/v1/namespaces/kube-system/services/node-local-dns:dns/proxy
vscode@nyu:/app$ docker push us.icr.io/nyu-devops-wishlist/wishlist:1.0
The push refers to repository [us.icr.io/nyu-devops-wishlist/wishlist]
56f14355b32e: Pushed
7e208abcb39d: Pushed
7891f99f5956: Layer already exists
8b5fb989de77: Layer already exists
a62c01774364: Layer already exists
b64a5e2bc16c: Layer already exists
466ee1641be0: Layer already exists
150de0b737bd: Layer already exists
00c1be188a46: Layer already exists
5772b8372e59: Layer already exists
a12586ed027f: Layer already exists
1.0: digest: sha256:bfb9557067bef603ad5659057b3209bec08e3cf11b52bf265329fd121e28a96a size: 2625
vscode@nyu:/app$ export NAMESPACE=nyu-devops-wishlist
vscode@nyu:/app$ make build
Building us.icr.io/nyu-devops-wishlist/wishlist:1.0 for "linux/amd64"...
docker buildx build --file Dockerfile --pull --platform="linux/amd64" --tag us.icr.io/nyu-devops-wishlist/wishlist:1.0 --load .
[+] Building 88.4s (12/12) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 32B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/python:3.9-slim 1.0s
=> [internal] load build context 0.0s
=> => transferring context: 1.07kB 0.0s
=> [1/7] FROM docker.io/library/python:3.9-slim@sha256:b0877ce9f4d0888fe3e594461a 17.2s
=> => resolve docker.io/library/python:3.9-slim@sha256:b0877ce9f4d0888fe3e594461a3 0.0s
=> => sha256:a603fa5e3b4127f210503aaa6189abf6286ee5a73deeaab460 31.41MB / 31.41MB 15.6s
=> => sha256:b00aaacf759c581712fa578a6b4e8e0b9fc780919a5d835a16845 1.08MB / 1.08MB 0.6s
=> => sha256:d50f75309cbe5622982b1b3b296361cb00825e87f028f0edef3 11.59MB / 11.59MB 7.4s
=> => sha256:b0877ce9f4d0888fe3e594461a320ae081ae457aa9006374570b0 1.86kB / 1.86kB 0.0s
=> => sha256:b4d0c35ddd4112d3092933182965a2d26d90a6219c88f571e946f 1.37kB / 1.37kB 0.0s
=> => sha256:f7fe51e5e80af46de887fd150e3b136ee454ea4c73de469139867 7.48kB / 7.48kB 0.0s
=> => sha256:eea95839e7aaa8aa538343716153a70d50b051f9a258beac8bd6b9b4b 233B / 233B 0.8s
=> => sha256:7e51b158a7a6122704c27f71ca96c5589cae12e9f2cccb61e0ec4 3.18MB / 3.18MB 3.9s
=> => extracting sha256:a603fa5e3b4127f210503aaa6189abf6286ee5a73deeaab460f8f33ebc 0.9s
=> => extracting sha256:b00aaacf759c581712fa578a6b4e8e0b9fc780919a5d835a168457b754 0.1s
=> => extracting sha256:d50f75309cbe5622982b1b3b296361cb00825e87f028f0edef33b71c77 0.3s
=> => extracting sha256:eea95839e7aaa8aa538343716153a70d50b051f9a258beac8bd6b9b4b8 0.0s
=> => extracting sha256:7e51b158a7a6122704c27f71ca96c5589cae12e9f2cccb61e0ec42545c 0.2s
=> [2/7] RUN apt-get update && apt-get install -y gcc libpq-dev 32.0s
=> [3/7] WORKDIR /app 0.0s
=> [4/7] COPY requirements.txt . 0.0s
=> [5/7] RUN pip install -U pip wheel && pip install --no-cache-dir -r requir 36.9s
=> [6/7] COPY service/ ./service/ 0.0s
=> [7/7] RUN useradd --uid 1000 vagrant && chown -R vagrant /app 0.2s
=> exporting to image 0.9s
=> => exporting layers 0.9s
=> => writing image sha256:a0948d8485bb251754e76e1a618bc25665f448abc40a353b28ad262 0.0s
=> => naming to us.icr.io/nyu-devops-wishlist/wishlist:1.0 0.0s
vscode@nyu:/app$ kc logs pod/wishlist-64c8bb8fcd-wx2gk
[2022-11-15 15:08:47 +0000] [1] [INFO] Starting gunicorn 20.1.0
[2022-11-15 15:08:47 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2022-11-15 15:08:47 +0000] [1] [INFO] Using worker: sync
[2022-11-15 15:08:47 +0000] [7] [INFO] Booting worker with pid: 7
[2022-11-15 15:08:53 +0000] [INFO] [log_handlers] Logging handler established
[2022-11-15 15:08:53 +0000] [INFO] [__init__] **********************************************************************
[2022-11-15 15:08:53 +0000] [INFO] [__init__] ****************** S E R V I C E R U N N I N G *******************
[2022-11-15 15:08:53 +0000] [INFO] [__init__] **********************************************************************
[2022-11-15 15:08:53 +0000] [INFO] [__init__] Service initialized!
$ docker exec -it -u vscode wishlist bash
vscode@nyu:/app$
As a Developer I need a Kubernetes Cluster on IBM Cloud So that I can use it to deploy wishlist application on the cloud
Details and Assumptions
It should be accessible to all the members of the squad.
Acceptance Criteria