Member-only story

Create Kubernetes K8s or OpenShift OCP Service — Ansible module k8s

How to automate the creation of “nginx-service” Service and “nginx” Pod in namespace “example” of Kubernetes K8s or OpenShift OCP with Ansible module k8s.

Luca Berton
6 min readApr 13, 2022

How to create Kubernetes K8s or OpenShift OCP Service with Ansible?
I’m going to show you a live demo and some simple Ansible code.
I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible create Kubernetes or OpenShift Service

  • kubernetes.core.k8s
  • Manage Kubernetes (K8s) objects

Let’s talk about the Ansible module `k8s`.

The full name is `kubernetes.core.k8s`, which means that is part of the collection of modules of Ansible to interact with Kubernetes and Red Hat OpenShift clusters.

It manages Kubernetes (K8s) objects.

Parameters

  • name string /namespace string — object name / namespace
  • api_version string — “v1”

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet