피드 구독

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. ]


저자 소개

Matt Heon has been a software engineer on Red Hat's Container Runtimes team for the last five years. He's one of the original authors and lead maintainers of the Podman project. He focuses on container security, networking, and low-level development.

Read full bio
UI_Icon-Red_Hat-Close-A-Black-RGB

채널별 검색

automation icon

오토메이션

기술, 팀, 인프라를 위한 IT 자동화 최신 동향

AI icon

인공지능

고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

open hybrid cloud icon

오픈 하이브리드 클라우드

하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Original series icon

오리지널 쇼

엔터프라이즈 기술 분야의 제작자와 리더가 전하는 흥미로운 스토리