Using GitHub Actions to deploy applications to IBM Cloud Kubernetes Service

In this post, hear from @stevemar, a Senior Technical Staff Member at IBM, about a new GitHub Starter Workflow for developers deploying containerized applications to IBM Cloud Kubernetes Service.  Here…

|
| 2 minutes

In this post, hear from @stevemar, a Senior Technical Staff Member at IBM, about a new GitHub Starter Workflow for developers deploying containerized applications to IBM Cloud Kubernetes Service. 

Here at IBM, we’re one of GitHub’s top users, with hundreds of orgs and thousands of commits per day. We’re such big fans that we wanted to share a new GitHub Starter Workflow we recently announced that will get you deploying your containerized applications to IBM Cloud Kubernetes Service faster. The IBM Cloud Kubernetes Service supports multizone clusters, managed cluster updates, and compliance certifications for regulated workloads (PCI, HIPAA, GDPR, SOC1, and SOC2 Type 2). With just a few clicks, you can leverage GitHub Actions to generate a workflow, which can be customized to your cluster and application needs.

GitHub Starter Workflow for IBM Cloud Kubernetes Service

Let’s take a look at how to use this new workflow. When you click the “Actions” tab of any GitHub repository, you’ll immediately see IBM Cloud Kubernetes Service as an option for you to deploy on.

Screenshot showing selection of 'Deploy to IBM Cloud Kubernetes Service'

When you select Deploy to IBM Cloud Kubernetes Service, a workflow is generated for you. By default, the workflow performs the following steps:

  • Installs IBM Cloud CLI
  • Authenticates with IBM Cloud CLI
  • Builds the Docker image
  • Pushes the image to IBM Cloud Container Registry
  • Deploys the Docker image to a IBM Cloud Kubernetes Service cluster

Screenshot of GitHub action for this workflow

Before committing the file, be sure to configure the IMAGE_NAME, IKS_CLUSTER, DEPLOYMENT_NAME, and PORT fields. Additionally, you’ll need to create two GitHub Secrets, one for your IBM Cloud API key and one for your IBM Cloud Container Registry namespace.

GITHUB_SHA: ${{ github.sha }}
IBM_CLOUD_API_KEY: ${{ secrets.IBM_CLOUD_API_KEY }}
IBM_CLOUD_REGION: us-south
ICR_NAMESPACE: ${{ secrets.ICR_NAMESPACE }}
REGISTRY_HOSTNAME: us.icr.io
IMAGE_NAME: iks-test
IKS_CLUSTER: example-iks-cluster-name-or-id
DEPLOYMENT_NAME: iks-test
PORT: 5001

When you’re ready to test it out, create a release and see the workflow in action! Here is a sample run:

For an in-depth look at how the workflow was written, check out “Use a GitHub Action to deploy an app to Kubernetes” on the IBM Developer blog. Interested in trying this out? Get started.

What’s next

We plan to create distinct actions for installation and authentication of the IBM Cloud CLI in the future. Doing so will better help other developers create IBM Cloud workflows.

If you have questions or concerns, please reach out to our team via Slack. Register and join the discussion in the #general channel. We hope to see you there!

Related posts