The podman play kube command now supports deployments


One of the most exciting features we’ve added to Podman is support for interacting with Kubernetes objects. With the podman generate kube command, Podman can export your existing containers into Kubernetes Pod YAML for import into an OpenShift or Kubernetes cluster. The podman play kube command does the opposite, taking Kubernetes YAML and running it in Podman. Initially, the play kube command only supported running Pod YAML. However, most Kubernetes users prefer using the more-flexible Deployment YAML, which we did not support. With the Podman v2.0 release, we’ve addressed this, and Deployment YAML can now be used with the podman play kube command.

Migrations

When we first added podman generate kube and podman play kube, we intended to provide a way to ease migration to Kubernetes. Podman only runs containers on a single node, which means that users often outgrow it as their workloads increase. We wanted to give cluster admins an easy on-ramp to move their work to Kubernetes, an industry-standard solution for managing containers across many nodes. The podman generate kube command makes this possible. We added podman play kube to complement this by allowing developers to test their new YAML locally before deploying it. Our latest support for Deployments makes this much more usable.

Example

Let’s look at an example Deployment from the Kubernetes documentation:

$ cat ./nginx-deployment.yaml  
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

We can easily run this with podman play kube:

$ podman play kube ./nginx-deployment.yaml                                                                        
Trying to pull docker.io/library/nginx:1.14.2...
Getting image source signatures
Copying blob 27833a3ba0a5 done   
Copying blob 0f23e58bd0b7 done   
Copying blob 8ca774778e85 done   
Copying config 295c7be079 done   
Writing manifest to image destination
Storing signatures
Pod:
b4a261247bb458a6be85c600368c5563d086ac1925f4b4f2760bff6b74cd5084
Container:
d969453f4cc39a90a3d3cdcb0429851ea2f4a1e6a9e0deddef0e75204238fa1a
 
Pod:
6e838493599b1b93ca61b30e9bd4a783fc0d5fa5cb9544c8321e499668b1f318
Container:
1548c6b6420108dd13fe237c5da7f120f544293dfc2003f8c30b53dd6e94db39
 
Pod:
7e1a842a18d3cdc423b5408f4353a39ecd87819afcde5f0724842ca62b38bc5c
Container:
1506e5fc3f217403a866de2aaa961a667a423b392efdcc29c197934a5074a039

You can see that the YAML specifies three replicas, so Podman created three pods, each with one container. Let’s do a quick podman ps to see what it made:

$ podman ps -a
CONTAINER ID  IMAGE                 COMMAND               CREATED         STATUS             PORTS   NAMES
0c3fa04969f7  nginx:1.14.2         /docker-entrypoin...  14 seconds ago  Up 13 seconds ago          nginx-deployment-pod-0-nginx
1b50823b01b9  k8s.gcr.io/pause:3.2                        11 seconds ago  Up 8 seconds ago           b461352502f0-infra
56b683ea398b  nginx:1.14.2          /docker-entrypoin...  8 seconds ago   Up 8 seconds ago           nginx-deployment-pod-2-nginx
83276e1e562b  k8s.gcr.io/pause:3.2                        15 seconds ago  Up 13 seconds ago          16d50303cb06-infra
cb7c430f65d1  nginx:1.14.2          /docker-entrypoin...  11 seconds ago  Up 11 seconds ago          nginx-deployment-pod-1-nginx
fe6eefdfd7c4  k8s.gcr.io/pause:3.2                        13 seconds ago  Up 11 seconds ago          288bcb7e5f7c-infra

You can see three infra (Pause) containers and three Nginx containers, one of each per pod, all of them running. Success!

Future plans

Unfortunately, while we can now run deployments with podman play kube, we can’t create them yet. The podman generate kube command is not yet able to output Deployment YAML. We plan on working on this for a future release, but contributions are always welcome.

Community contribution

One of the best things about this new feature is that it was added by a community member, Aditya Kamath. The Podman Project is very thankful for the contribution. It is more proof of the power of open source.

[ Getting started with containers? Check out this free course. Deploying containerized applications: A technical overview. ]



Source link

Recent articles

Mueller’s Team Could Have Done More to Investigate Trump-Russia Links, Insider Says

WASHINGTON — The team led by Robert S. Mueller III, the special counsel, failed to do everything it could to determine what happened...

WRC 9 Review – Don’t Cut (PS4)

Last year’s WRC 8 introduced us to a whole new career mode, and officially put the Dirt series on notice. One year later,...

Boeing lays off pilot group that supports service entry of new aircraft types | News

Boeing is laying off a group of seven “line-assist instructor pilots” whose work includes helping airlines bring into their fleets aircraft types that...

Is there life on Venus? | Opinion

The news that phosphine has been detected in Venus’s upper atmosphere elicited great excitement among inorganic chemists last week (Nat. Astron., DOI: 10.1038/s41550-020-1174-4)....

Fed’s Kaplan says he’s worried new forward guidance will spark risky trading

The new Federal Reserve forward guidance could create “fragilities” and “excesses” in financial markets,...

CDC Says Covid-19 Can Be Airborne, Then Takes It Back

Masks remain a good way to lower the risk of covid-19 spreading in the population, either through droplets or aerosols. Photo:

Leave a reply

Please enter your comment!
Please enter your name here