1podman-generate-kube(1)()                            podman-generate-kube(1)()
2
3
4

NAME

6       podman-generate-kube  -  Generate  Kubernetes YAML based on containers,
7       pods or volumes
8
9

SYNOPSIS

11       podman generate kube [options] container... | pod... | volume...
12
13

DESCRIPTION

15       podman generate kube will generate Kubernetes YAML  (v1  specification)
16       from  Podman containers, pods or volumes. Whether the input is for con‐
17       tainers or pods, Podman will always generate  the  specification  as  a
18       Pod.  The  input  may be in the form of one or more containers, pods or
19       volumes names or IDs.
20
21
22       Podman Containers or Pods
23
24
25       Volumes appear in the generated YAML according to two different  volume
26       types. Bind-mounted volumes become hostPath volume types and named vol‐
27       umes become persistentVolumeClaim volume types. Generated hostPath vol‐
28       ume  types  will be one of three subtypes depending on the state of the
29       host path: DirectoryOrCreate when no file or directory  exists  at  the
30       host,  Directory  when host path is a directory, or File when host path
31       is a file. The value for claimName for a persistentVolumeClaim  is  the
32       name of the named volume registered in Podman.
33
34
35       Potential  name  conflicts between volumes are avoided by using a stan‐
36       dard naming scheme for each volume type. The hostPath volume types  are
37       named  according  to  the  path  on the host machine, replacing forward
38       slashes with hyphens less any leading and trailing forward slashes. The
39       special  case  of  the filesystem root, /, translates to the name root.
40       Additionally, the name is suffixed with -host to avoid naming conflicts
41       with  persistentVolumeClaim  volumes. Each persistentVolumeClaim volume
42       type uses the name of its associated named volume suffixed with -pvc.
43
44
45       Note that the generated Kubernetes YAML file can be used to re-run  the
46       deployment via podman-play-kube(1).
47
48

OPTIONS

50   --filename, -f=filename
51       Output  to  the  given file, instead of STDOUT. If the file already ex‐
52       ists, generate kube will refuse to replace it and return an error.
53
54
55   --service, -s
56       Generate a Kubernetes service object in addition to the Pods.  Used  to
57       generate  a  Service specification for the corresponding Pod output. In
58       particular, if the object has portmap bindings, the service  specifica‐
59       tion  will include a NodePort declaration to expose the service. A ran‐
60       dom port is assigned by Podman in the specification.
61
62

EXAMPLES

64       Create Kubernetes Pod YAML for a container called some-mariadb.
65
66
67              $ sudo podman generate kube some-mariadb
68              # Generation of Kubernetes YAML is still under development!
69              #
70              # Save the output of this file and use kubectl create -f to import
71              # it into Kubernetes.
72              #
73              # Created with podman-0.11.2-dev
74              apiVersion: v1
75              kind: Pod
76              metadata:
77                creationTimestamp: 2018-12-03T19:07:59Z
78                labels:
79                  app: some-mariadb
80                name: some-mariadb-libpod
81              spec:
82                containers:
83                - command:
84                  - docker-entrypoint.sh
85                  - mysqld
86                  env:
87                  - name: PATH
88                    value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
89                  - name: TERM
90                    value: xterm
91                  - name: HOSTNAME
92                  - name: container
93                    value: podman
94                  - name: GOSU_VERSION
95                    value: "1.10"
96                  - name: GPG_KEYS
97                    value: "199369E5404BD5FC7D2FE43BCBCB082A1BB943DB \t177F4010FE56CA3336300305F1656F24C74CD1D8
98                      \t430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A \t4D1BB29D63D98E422B2113B19334A25F8507EFA5"
99                  - name: MARIADB_MAJOR
100                    value: "10.3"
101                  - name: MARIADB_VERSION
102                    value: 1:10.3.10+maria~bionic
103                  - name: MYSQL_ROOT_PASSWORD
104                    value: x
105                  image: quay.io/baude/demodb:latest
106                  name: some-mariadb
107                  ports:
108                  - containerPort: 3306
109                    hostPort: 36533
110                    protocol: TCP
111                  resources: {}
112                  securityContext:
113                    allowPrivilegeEscalation: true
114                    privileged: false
115                    readOnlyRootFilesystem: false
116                  tty: true
117                  workingDir: /
118              status: {}
119
120
121
122       Create  Kubernetes  Pod  YAML  for  a  container  with  the   directory
123       /home/user/my-data  on  the host bind-mounted in the container to /vol‐
124       ume.
125
126
127              $ podman generate kube my-container-with-bind-mounted-data
128              # Generation of Kubernetes YAML is still under development!
129              #
130              # Save the output of this file and use kubectl create -f to import
131              # it into Kubernetes.
132              #
133              # Created with podman-3.1.0-dev
134              apiVersion: v1
135              kind: Pod
136              metadata:
137                creationTimestamp: "2021-03-18T16:26:08Z"
138                labels:
139                  app: my-container-with-bind-mounted-data
140                name: my-container-with-bind-mounted-data
141              spec:
142                containers:
143                - command:
144                  - /bin/sh
145                  env:
146                  - name: PATH
147                    value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
148                  - name: TERM
149                    value: xterm
150                  - name: container
151                    value: podman
152                  image: docker.io/library/alpine:latest
153                  name: test-bind-mount
154                  resources: {}
155                  securityContext:
156                    allowPrivilegeEscalation: true
157                    capabilities:
158                      drop:
159                      - CAP_MKNOD
160                      - CAP_NET_RAW
161                      - CAP_AUDIT_WRITE
162                    privileged: false
163                    readOnlyRootFilesystem: false
164                    seLinuxOptions: {}
165                  volumeMounts:
166                  - mountPath: /volume
167                    name: home-user-my-data-host
168                  workingDir: /
169                dnsConfig: {}
170                restartPolicy: Never
171                volumes:
172                - hostPath:
173                    path: /home/user/my-data
174                    type: Directory
175                  name: home-user-my-data-host
176              status: {}
177
178
179
180       Create Kubernetes Pod YAML for a container with the named volume price‐
181       less-data mounted in the container at /volume.
182
183
184              $ podman generate kube my-container-using-priceless-data
185              # Generation of Kubernetes YAML is still under development!
186              #
187              # Save the output of this file and use kubectl create -f to import
188              # it into Kubernetes.
189              #
190              # Created with podman-3.1.0-dev
191              apiVersion: v1
192              kind: Pod
193              metadata:
194                creationTimestamp: "2021-03-18T16:26:08Z"
195                labels:
196                  app: my-container-using-priceless-data
197                name: my-container-using-priceless-data
198              spec:
199                containers:
200                - command:
201                  - /bin/sh
202                  env:
203                  - name: PATH
204                    value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
205                  - name: TERM
206                    value: xterm
207                  - name: container
208                    value: podman
209                  image: docker.io/library/alpine:latest
210                  name: test-bind-mount
211                  resources: {}
212                  securityContext:
213                    allowPrivilegeEscalation: true
214                    capabilities:
215                      drop:
216                      - CAP_MKNOD
217                      - CAP_NET_RAW
218                      - CAP_AUDIT_WRITE
219                    privileged: false
220                    readOnlyRootFilesystem: false
221                    seLinuxOptions: {}
222                  volumeMounts:
223                  - mountPath: /volume
224                    name: priceless-data-pvc
225                  workingDir: /
226                dnsConfig: {}
227                restartPolicy: Never
228                volumes:
229                - name: priceless-data-pvc
230                  persistentVolumeClaim:
231                    claimName: priceless-data
232              status: {}
233
234
235
236       Create  Kubernetes Pod YAML for a pod called demoweb and include a ser‐
237       vice.
238
239
240              $ sudo podman generate kube -s demoweb
241              # Generation of Kubernetes YAML is still under development!
242              #
243              # Save the output of this file and use kubectl create -f to import
244              # it into Kubernetes.
245              #
246              # Created with podman-0.12.2-dev
247              apiVersion: v1
248              kind: Pod
249              metadata:
250                creationTimestamp: 2018-12-18T15:16:06Z
251                labels:
252                  app: demoweb
253                name: demoweb-libpod
254              spec:
255                containers:
256                - command:
257                  - python3
258                  - /root/code/graph.py
259                  env:
260                  - name: PATH
261                    value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
262                  - name: TERM
263                    value: xterm
264                  - name: HOSTNAME
265                  - name: container
266                    value: podman
267                  image: quay.io/baude/demoweb:latest
268                  name: practicalarchimedes
269                  resources: {}
270                  securityContext:
271                    allowPrivilegeEscalation: true
272                    capabilities: {}
273                    privileged: false
274                    readOnlyRootFilesystem: false
275                  tty: true
276                  workingDir: /root/code
277              status: {}
278              ---
279              apiVersion: v1
280              kind: Service
281              metadata:
282                creationTimestamp: 2018-12-18T15:16:06Z
283                labels:
284                  app: demoweb
285                name: demoweb-libpod
286              spec:
287                ports:
288                - name: "8050"
289                  nodePort: 31269
290                  port: 8050
291                  protocol: TCP
292                  targetPort: 0
293                selector:
294                  app: demoweb
295                type: NodePort
296              status:
297                loadBalancer: {}
298
299
300

SEE ALSO

302       podman(1), podman-container(1), podman-pod(1), podman-play-kube(1)
303
304

HISTORY

306       December 2018, Originally compiled by Brent Baude (bbaude at redhat dot
307       com)
308
309
310
311                                                     podman-generate-kube(1)()
Impressum