How to Debug SUSI Bots Deployment on Google Container Engine Using Kubernetes

You can learn how to deploy SUSI bots on to Google container engine using Kubernetes from this tutorial. In this blog, we will learn how to debug SUSI bots deployment to keep them running continuously. Whenever we create a deployment on Google container using Kubernetes a pod is created in which our deployment keeps running. Whenever we deploy bots to any platform to check if it is working right or not we refer to logs of that bot. To get logs first we will get pod for our deployment with this kubectl get pods --namespace={your-namespace-of-deployment-here} This will show us the pod for our deployment like this Copy the name of this pod and enter this command to get logs kubectl get logs {your-pod-here} --namespace={your-namespace-of-deployment-here} This will show us the logs of our deployment. In Google cloud console you will not get running logs. You will get logs of the everything that has happened before you requested for logs. Now if there is some error in logs and you need to restart the deployment but in Kubernetes you can not restart your pod directly but to restart pod we will need to enter the following command kubectl replace --force -f {path-to-your-deployment-config-file} If everything goes well you will get to see the following with your deployment name in it After deployment, if you want to see the services and deployment in detail follow the approach given below To get services write this command kubectl get service --namespace={your-namespace-of-deployment-here} When you will get service it will look like If you don’t get your external IP then check your service config file and after fixing it make a new deployment after deleting previous one. To check deployment in detail write following command kubectl describe deployments --namespace={your-namespace-of-deployment-here} This will show us details about deployment like this You can now easily solve issues with deployments now. Resources Debugging Kubernetes service locally using telepresence: https://www.telepresence.io/tutorials/kubernetes.html Debug Services: https://kubernetes.io/docs/tasks/debug-application-cluster/debug-service/ Troubleshooting Kuberetes: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_atomic_host/7/html/getting_started_with_kubernetes/troubleshooting_kubernetes  

Continue ReadingHow to Debug SUSI Bots Deployment on Google Container Engine Using Kubernetes

How to Deploy Node js App to Google Container Engine Using Kubernetes

There are many ways to host node js apps. A popular way is to host your app on Heroku. We can also deploy our app to Google cloud platform on container engine using Kubernetes. In this blog, we will learn how to deploy node js app on container engine with kubernetes. There are many resources on the web but we will use YAML files to create a deployment and to build docker image we will not use Google container registry (GCR) as it will cost us more for the deployment. To deploy we will start by creating an account on Google cloud and you can get a free tier of Google cloud platform worth 300$ for 12 months. After creating account create a project with any name of your choice. Enable Google cloud shell from an icon on right top. We will also need a docker image of our app for deployment. To create a docker image first create an account on https://www.docker.com and create a repository with any name on it. Now, we will add docker file into our repository so that we can build docker image. Dockerfile will contain this code: FROM node:boron # Create app directory RUN mkdir -p /usr/src/app WORKDIR /usr/src/app # Install app dependencies COPY package.json /usr/src/app RUN npm install # Bundle app source COPY . /usr/src/app EXPOSE 8080 CMD [ "npm", "start" ] You can see an example of docker file in SUSI telegram repository. After pushing docker file to your repository we will now build docker image of the app. In Google cloud shell clone, your repository with git clone {your-repository-link here }and change your current directory to the cloned app. We will use --no-cache -t arguments as described above it will be better for building docker image and it will use fewer resources. Run these two commands to build docker image and pushing it to your docker hub. docker build --no-cache -t {your-docker-username-here}/{repository-name-on-docker here} . docker push {your-docker-username-here}/{repository-name-on-docker here} We have successfully created docker image for our app. Now we will deploy our app to container engine using this image. To deploy it we will use configuration files. Add a yaml folder in your repository and we will add four files into it now. In the first file, we will specify the namespace and name it as 00-namespace.yml It will contain following code: apiVersion: v1 kind: Namespace metadata:  name: web In second file we will configure our namespace that we specified and name it as configmap.yml It will contain following code: apiVersion: v1 metadata:  name:{name-of-your-deployment-here}  namespace: web kind: ConfigMap In third file, we will define our deployment and name it as deployment.yml It will contain following code: kind: Deployment apiVersion: apps/v1beta1 metadata:  name: {name-of-your-deployment-here}  namespace: web spec:  replicas: 1  template:    metadata:      labels:        app: {name-of-your-deployment-here}    spec:      containers:      - name: {name-of-your-deployment-here}        image: {your-docker-username-here}/{repository-name-on-docker here}:latest        ports:        - containerPort: 8080          protocol: TCP        envFrom:        - configMapRef:            name: {name-of-your-deployment-here}      restartPolicy: Always In fourth file, we will define service for our deployment and name it as service.yml It will…

Continue ReadingHow to Deploy Node js App to Google Container Engine Using Kubernetes