Kubernetes can bring a wide collection of advantages to a development organization. Properly using Kubernetes can significantly improve productivity, empower you to better utilize your cloud spend, and improve application stability and reliability. On the flip side, if you are not properly leverag Kubernetes, your would-be benefits become drawbacks. As a developer, this can become incredibly frustrating when your focus is on delivering quality code fast. The learning curve and management of the object-centric application architecture, scripting, integrations into multiple CI systems and pipelines, and managing infrastructure can all make you less productive. According to a survey conducted by Tidelift and The New Stack, just 32% of a developer’s time is spent writing new code or improving existing code. The other 68% is spent in meetings, code maintenance, testing, security issues, and more.

What if developers could take full advantage of the benefits of Kubernetes while avoiding its pitfalls? In this tutorial, we will show how CircleCI and Shipa together can empower teams to get the best possible performance out of Kubernetes. How does it work? CircleCI maximizes speed with customizable pipelines, while Shipa simplifies Kubernetes. The combination gives developers more time to do what they do best: develop quality software quickly, without changing the way they work. Your platform engineering team can manage, secure, and deliver a powerful Kubernetes platform that benefits the entire development organization.

Prerequisites

For this example, we assume you have:

CI pipeline with Shipa

Getting started

In this tutorial, we will use CircleCI and the Shipa orb to deliver our application to Kubernetes clusters. Orbs are reusable snippets of code that help automate repeated processes, speed up project setup, and make it easy to integrate with third-party tools like Shipa.

The application source code for this tutorial is available here.

Setting up environment variables on CircleCI

For CircleCI to successfully connect to Shipa and deliver application code through the CircleCI Shipa orb, we will need to set up these environment variables in our CircleCI project:

  • SHIPA_APP_NAME This is the name of your application. Create the application on Shipa before your pipeline runs by following these instructions: https://learn.shipa.io/docs/application#creating-an-application
  • SHIPA_CA This is the client certificate you use to connect to your Shipa target instance. You can retrieve your certificate by running the following command:
cat ~/.shipa/certificates/<instance-name>/ca.crt | base64
  • SHIPA_USER This is the username you use to log into Shipa

  • SHIPA_PASSWORD This is the password you use to log into Shipa

  • SHIPA_SERVER This is the address of your Shipa target instance. You can get this address by running the command:

shipa target list

To define these environment variables, go to your project’s settings page. Click Environment Variables in the column on the left, and then Add Variable.

Setting up Shipa

For this tutorial, you will need an application created on Shipa. Also see getting started with Shipa for more info.

Here is a quick example of how to set up our app on Shipa.

First, we enable the Ruby platform on Shipa, so our sample Ruby code can be deployed:

shipa platform add ruby

Then we create our application that will receive the app code from CircleCI:

shipa app create circleci ruby -t shipa-admin-team -o shipa-pool

The application name we are using for our sample project is circleci, but you can name it whatever works best for you. Just make sure you pass the correct name in the SHIPA_APP_NAME variable.

Setting up the CircleCI pipeline

Using the CircleCI Shipa orb, we will:

  • Check out our application code
  • Setup Shipa
  • Deploy the application through Shipa

For CircleCI and the Shipa orb to do this, we need to create a config.yml file inside a folder named .circleci. Here is the config.yml we are using.

# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
# Use a package of configuration called an orb.
orbs:
  # Declare a dependency on the welcome-orb
  shipa: shipa/orb@0.6.0
# Orchestrate or schedule a set of jobs
jobs:
  shipa-deploy:
    executor: shipa/default
    steps:
      - checkout
      - shipa/install
      - shipa/app-deploy
workflows:
  # Name the workflow "welcome"
  welcome:
    # Run the welcome/run job in its own container
    jobs:
      - shipa-deploy

Deploying with Shipa

Now we need to run our CircleCI pipeline and wait for it to complete.

CircleCI dashboard with shipa-deploy job success

When the pipeline has finished, our application is successfully deployed and available from the Shipa CLI by typing the following into your terminal:

shipa app list

You can also see the app deployed from the Shipa dashboard.

CircleCI dashboard with shipa-deploy job success

From here, both developers and operators have access to a vast amount of information related to our circleci app including:

  • logs
  • audit trails
  • network policies
  • CNAME management
  • monitoring information
  • integration into incident management tools
  • application dependency maps

Conclusion

Using the Shipa orb to integrate with CircleCI, developers can focus on application code while DevOps and platform engineers can focus on controls and guardrails.