Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

That app you love, part 6: Container, meet cloud

October 13, 2016
N. Harrison Ripps
Related topics:
ContainersDeveloper ToolsKubernetesMicroservices
Related products:
Red Hat OpenShift Container Platform

Share:

    Welcome to the sixth installment of That App You Love, a blog series in which I show you how to you can make almost any app into a first-class cloud citizen. If you want to start from the beginning, jump back and check out Part 1: Making a Connection. You’ll need the docker service and the oc utility to follow along in this post; for instructions check out Part 5: Upping Our (Cloud) Game.

    We’ve been on a pretty amazing journey so far! Now that we’ve learned how to identify and expose the flexibility need in our app, and how to create a config-and-run container image that will make our app run with the settings that are important to us, it’s finally time to get this ship sailing! For these examples, we’re going to continue using my containerized ZNC app, but hey - forget about ZNC, because we’re really talking about That App You Love, and what it takes to deploy that rock star app on the OpenShift Container Platform.

    Start Cloud, Start App, Mind Blown

    In Part 5, I showed you how you can fire up an entire OpenShift Container Platform cluster with a single command. If you didn’t read it, you should go back because we will be spending a lot of time playing around in this portable mini-cloud.

    Ready? Let’s just jump straight in:

    1. If your docker service is not running, fire it up! Fedora shortcut:
      sudo systemctl start docker
      
    2. Did you download the `oc` binary? If not, head back to Part 5. If you did, fire it up!
      sudo <path_to>/oc cluster up
      
    3. Find the OpenShift server IP/Port combo in the output from “cluster up” (ending in 8443) and use it to log in as a non-root user:
      oc login -u developer -p developer --server=<server_IP>:8443
      
    4. And now, let’s launch znc-cluster-app straight into OpenShift:
      oc new-app nhripps/znc-cluster-app:latest

    When you fired up your cluster, one of the items in the output is the URL for your mini-cloud’s web console. Look for a line with port number 8443 in it; that will be the one.

    You can log into the web console and see what happened by opening that web console URL and using username ‘developer’, password ‘developer’ to log in.

    Per our last post, you’re going to see a Projects overview page:

    that_app_you_love_img2

    Click on My Project to see what the new-app command actually did:

    that_app_you_love_img4

    So how do we get to the ZNC homepage? Well, we’ll need to add something to our deployment. It’s time to learn about a few concepts relevant to Kubernetes and OpenShift...

    Cloud Parts: Pods, Services and Routes

    When you ran oc new-app, OpenShift created a number of helper objects on your behalf. For starters, let’s look at Pods, Services and Routes.

    Pods

    From the My Project page, use the left-hand navigation panel to move to Applications => Pods. You will see that you have one running pod with a name like ‘znc-cluster-app-1-6phwj’. Click on that Pod name to get some details:
    that_app_you_love_img5

    The Pod is Kubernetes way of combining a running container along with some metadata and other code necessary to make that container work as part of a cloud environment. You can click on the Logs tab to see the familiar output from our config-and-run script, or click on the Terminal tab to actually connect to a shell within the running container!

    At the bottom of the above screenshot, you can see that Kubernetes and OpenShift are aware of the port number that we are mapping (6697). But how does traffic actually find its way to that container?

    Services

    Next navigate to Applications => Services, where you will see a Service called ‘znc-cluster-app’. Click on that Service name to see the following information:

    that_app_you_love_img6

    What’s happening here? Inside our mini-cloud, Kubernetes has created a mapping between our target port (6697) and a Service IP / Service port combination. Here’s the interesting part - if we kill our running container and start a new one, the Service ensures that the new container is still reachable at the same Service IP / Service port combination.

    We can check that our app is indeed available by navigating to this in a web browser:

    https://<service_ip>:<service_port>/

    But that will only work on the same computer where we ran oc cluster up, which is effectively part of our mini cluster. So how do we make our app reachable outside of the cloud?

    Routes

    In the middle of the Service detail page, you should see a link titled ‘Create Route’. Click on this now. You will see the Create Route form:

    that_app_you_love_img7

    1. We don’t need to change any of the visible values, but scroll to the bottom and click the link titled “Show options for secured routes”. This will cause a number of extra options to appear.
    2. From the “TLS Termination” pulldown, select “Passthrough”. This ensures that all encrypted traffic to our app stays encrypted all the way to the container.
    3. Now scroll to the bottom and click the Create button.

    Finally, we’re back in the Service detail page, and there is a new entry in the Routes list ending in “xip.io”. Click on it and you should be taken directly to the ZNC web console (after accepting the self-signed certificate warning):

    that_app_you_love_img8

    Note - occasionally on my work VPN, I have seen the “xip.io” addresses fail to work. If this happens to you, try turning off your VPN connection, or tell your boss that I said it was okay for you to continue your research from a nearby coffee shop!

    Good Deal. What’s Next?

    If you want to log into the ZNC web console, you can do it with our default username/password values of ‘admin’/’admin’. But remember all of that work we did to make the container customizable? And remember how we want this app to run statefully in the stateless world of a container cluster? Starting with Part 7, we’re going to walk through the steps we need to take That App You Love from “nifty container app” to “powerhouse cloud app”.

    For now, remember that when you’re done playing around with your mini cloud, you can shut it down with:

    oc cluster down

    When you do, your app will disappear along with the cluster - our mini-cloud is itself running in a stateless container, after all. But not to worry! We’ll learn about a handy shortcut to get back to where we were, and find out how to expose the container environment variables we’ve created up at the cluster level, all in Part 7: Wired for Sound!

    This series will run every Tuesday and Thursday until we've accomplished our goals, so stay tuned in, subscribe, and thanks for reading!

    Title Date
    That app you love, part 1: Making a connection 2016/09/27
    That app you love, part 2: Immutable but flexible – What settings matter? 2016/09/29
    That app you love, part 3: Every setting in its place 2016/10/04
    That app you love, part 4: Designing a config-and-run container 2016/10/06
    That app you love, part 5: Upping our (cloud) game 2016/10/11
    That app you love, part 6: Container, meet cloud 2016/10/13
    That app you love, part 7: Wired for sound 2016/10/18
    That app you love, part 8: A blueprint for “that app you love” 2016/10/20
    That app you love, part 9: Storage and statefulness 2016/10/25
    That app you love, part 10: Long live “that app you love” 2016/10/27

     

    About the Author

    Hi there! My name is N. Harrison Ripps, and I am an engineer and people manager on the Containers team at Red Hat. Together with the greater open source community, our team has taken the combination of the docker container format and Google’s Kubernetes orchestration system, and then extended this framework with a number of administrator- and developer-friendly features that we call the OpenShift Container Platform.

    Last updated: March 16, 2023

    Recent Posts

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    • How to integrate vLLM inference into your macOS and iOS apps

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue