Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Build your Kubernetes armory with Minikube, Kail, and Kubens

April 16, 2019
Kamesh Sampath
Related topics:
Developer toolsKubernetes

    Kubernetes has grown to be a de facto development platform for building cloud-native applications. As developers, we want to be productive from the word go, or, shall we say, from the word code. But to be productive, we must be armed with the right set of tools. In this article, I will take a look at three important tools that should become part of your Kubernetes tool chest, or armory.

      Minikube

    When you think of Kubernetes, several questions may come to mind, including:

    1. How do I set up each and every Kubernetes component?
    2. How do I configure Kubernetes correctly?
    3. Even if I set up and configure Kubernetes correctly, do I have to do this every time?

    The answer is Minikube, which can help you easily set up a proper Kubernetes node suitable for your everyday development needs.

    To get going, the minikube start command just brings up a single-node Kubernetes environment with 2GB RAM, 2 CPUS, and a disk of 20GB.

    Running the command:

    minikube ip

    will let you know the IP of the Kubernetes node that is part of the virtual machine started by Kubernetes.

    I was able to deploy small lightweight applications with the default config, but then one day I needed to build a bigger Kubernetes node with a memory of 8GB RAM, 4 CPUS, and a disk of size 50GB. To get this kind of configuration, you can use:

    minikube start --memory=8192 --cpus=4 --disk-size=50g

    As you become a more experienced Kubernetes user, you will have a Kubernetes environment for one set of applications, another for a different set of applications, and so on. This is super easy with what is called a “profile” in Minikube. Let's create a profile called sword, which will hold all our "cutting-edge" technology applications. To create your sword profile, you can just run the same minikube start but with a -p like:

    minikube start -p sword --memory=8192 --cpus=4 --disk-size=50g

    Minikube by default stores all files, config, and other related settings of the sword profile under $MINIKUBE_HOME/profiles/sword.  $MINIKUBE_HOME is an environment variable that Minikube understands to be the place to store the Minikube virtual machine artifacts, such as configs, disks, etc.,

    A good first step! Now, I will teach you a tip. Here's how to invoke a Kubernetes service, for example, a "customer" using Minikube:

    minikube service customer

    When learning how to use these tools; however, we need to consider other tools as well.

    Kubens: Switch Kubernetes namespaces

    Kubernetes by default has the many namespaces, such as default, kube-public, and kube-system. Any resource you create without a namespace is created in namespace default.

    For example, executing the following command without --namespace or -n option, would create the "dagger" configmap in default namespace.

     kubectl create configmap dagger --from-literal size=small

    In considering application development priorities, we quite often miss this subtle behavior.  That's when we start to spend sleepless nights and weekends wondering, why is this not working for me?

    By adding kubens to our armory, we can set the namespace in which we will be creating the resources. Let's say we have a namespace called vikings; we can set that to be namespace for all our resources just by running the kubens vikings command. When we then try to create any resource without the --namespace or -n option, Kubernetes will by default create it in the vikings namespace.

    If you have to get back to the previous namespace, it's as simple as running the command kubens - (similar to Bash cd -).

    Kail: Watching logs

    Our tool chest is filling up nicely, but we still lack vital tools. As part of our everyday job, we need to analyze the logs of the pods.

    Kubectl does have log commands, but that is primitive. We need a tool that can help us to filter logs based on some criteria, for example, pods that belong to Kubernetes deployment.

    By adding Kail to our toolkit, we will get even more power via filters to query and analyze the logs:

    • Pods by deployment — For example, get logs from pods that are part of the deployment dagger in namespace sword:
    kail -n sword -d dagger
    • Pods by service — Get logs of pods that are part of the service battle:
    kail -n sword --svc battle
    • Pods by label — Get logs of all pods with "size=large":
    kail -n sword --label size=large

    The filters could also be combined to filter the logs further. For example, suppose you want to view all the logs of service “battle” that do not have “size=large”:

    kail -n sword --svc battle --ignore size=large

    Kail has lot of other filters just run kail --help for more details. When I first started to use Kail, sometimes I didn't see the logs, but then I realized that my host time and Minikube time are different, so I had to add --since flag to my commands. For example, to query the pod logs for the last 2 hours (Kubernetes node time), use:

    kail -n sword --svc battle --since=2h

    That’s it for this article. Armed with these tools, we're ready to succeed in our code battle. In my next article, we will add more tools to our armory and expand our skills even more. Until then, happy coding!

    Tutorials

    Here are tutorials for our Kubernetes warriors:

    1. Istio: github.com/redhat-developer-demos/istio-tutorial
    2. Knative: github.com/redhat-developer-demos/knative-tutorial
    Last updated: September 3, 2019

    Recent Posts

    • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

    • How to manage TLS certificates used by OpenShift GitOps operator

    • Configure a split disk on OpenShift Container Platform

    • Red Hat Enterprise Linux 10.2 and 9.8: Top features for developers

    • What GPU kernels mean for your distributed inference

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    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
    © 2026 Red Hat

    Red Hat legal and privacy links

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

    Chat Support

    Please log in with your Red Hat account to access chat support.