Example - Deploy demochat to Kubernetes cluster
An end-to-end example for Kubernetes deployment
In this example we will deploy our
demochat application to Kubernetes.
demochat requires two services to run:
demochatwebserver that is implemented in Node and can be found at https://github.com/containers101/demochat
We will perfom the following steps:
- Build the Docker image for
- Deploy the
demochatservice to a Kubernetes cluster
- Access the running
demochatdeployment using a Codefresh pipeline
Demochat source code
The Demochat repository can be found and forked from here:
Building the Docker image for Demochat
Become familiar with basic Codefresh pipelines as explained in the quick start guide and then:
- Add your forked
demochatrepo in Codefresh (use the url above to find the repo).
- Choose the branch for your first build (in this case
- Select how you would like to setup your repository. In this case, our repo already has a Dockerfile, so we will select the middle option.
- Clicking on
Buildbutton will trigger a regular build.
- When the docker image will be created, go to the tab
Imagesto find the image
More info about how to add, build and push docker image you can find in the readme of repository https://github.com/containers101/demochat
Deploying the Demochat service to a Kubernetes cluster
- Go to your Account Configuration, by clicking on Account Settings on the left sidebar. On the first section called Integrations click the Configure button next to Kubernetes.
- Exit your account settings and then select
Kubernetesfrom the left sidebar to access your Kubernetes dashboard. Click on the button
Add New Service.
demochatapplication uses a Mongo database, therefore we need to add a
mongoservice with the following params (see the screenshot below).
- Then just click on the button
- The mongo service will appear on your Kubernetes dashboard.
- Click on the button
Add New Serviceto create a Demochat service.
- Use the screenshot below to specify the parameters of Demochat service.
|CLUSTER||choose one of your clusters|
|NAMESPACE||choose the namespace in the dropdown list|
Accessing the Demochat service
Kubernetes tab you can see the
The Demochat application is now successfully deployed! You can see the external endpoints of this service in the service view and access the application using its endpoint and port.
Click on the external endpoint and your browser window will open to show the running application.
Automating Demochat deployment using Codefresh pipelines
For automated Kubernetes deployments check the documentation for
- The dedicated deploy step in a pipeline.
- The cf-deploy-kubernetes step in a pipeline. This can also perform simple templating on Kubernetes manifests.
- Using a freestyle step with custom kubectl commands.
- Using The Helm package manager. See the Helm quick start guide.