Deploying Your App on KubeSail

How to deploy Node.JS, Python, and Rails apps into Kubernetes

Dan Pastusek
July 8, 2019

Node.JS

We've created deploy-node-app as a migration tool to help you deploy your existing Node.js application into Kubernetes. If you have not yet created an app, you can use create-node-app to bootstrap an new app with React, Express, Postgres, and Redis with one command.

Python

Create a Dockerfile

You can create an image containing your app by placing a file called Dockerfile in the root of your project. Update the line with your-daemon-or-script.py.

FROM python:3

WORKDIR /usr/src/app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "./your-daemon-or-script.py" ]

Ruby on Rails

Create a Dockerfile

FROM ruby:2.5
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
RUN mkdir /myapp
WORKDIR /myapp
COPY Gemfile /myapp/Gemfile
COPY Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
COPY . /myapp

EXPOSE 3000

# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]

Building your image

Run

docker build . -t username/your-image-name
docker push username/your-image-name

with username being your Dockerhub username.

Deploying your app to KubeSail

Once you've built your image and pushed to Docker hub, deploying it to KubeSail is simple! Just update the image section of the config below, and then hit apply.

Apply
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: your-app
spec:
selector:
matchLabels:
app: your-app
replicas: 1
template:
metadata:
labels:
app: your-app
spec:
containers:
- name: your-app
image: username/your-image-name
imagePullPolicy: Always
ports:
- name: listen-port
containerPort: 8080
resources:
requests:
cpu: 10m
memory: 128Mi
limits:
cpu: 1
memory: 256Mi
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Stay in the loop!

Give us a shout on twitter or gitter, checkout some of our GitHub repos and be sure to join our mailing list!