github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/docs/source/markdown/podman-generate-kube.1.md (about)

     1  % podman-generate-kube(1)
     2  ## NAME
     3  podman-generate-kube - Generate Kubernetes YAML based on a pod or container
     4  
     5  ## SYNOPSIS
     6  **podman generate kube** [*options*] *container* | *pod*
     7  
     8  ## DESCRIPTION
     9  **podman generate kube** will generate Kubernetes Pod YAML (v1 specification) from a Podman container or pod. Whether
    10  the input is for a container or pod, Podman will always generate the specification as a Pod. The input may be in the form
    11  of a pod or container name or ID.
    12  
    13  Note that the generated Kubernetes YAML file can be used to re-run the deployment via podman-play-kube(1).
    14  
    15  ## OPTIONS
    16  
    17  #### **--filename**, **-f**=**filename**
    18  
    19  Output to the given file, instead of STDOUT. If the file already exists, `generate kube` will refuse to replace it and return an error.
    20  
    21  #### **--service**, **-s**
    22  
    23  Generate a Kubernetes service object in addition to the Pods. Used to generate a Service specification for the corresponding Pod output. In particular, if the object has portmap bindings, the service specification will include a NodePort declaration to expose the service. A
    24  random port is assigned by Podman in the specification.
    25  
    26  ## EXAMPLES
    27  
    28  Create Kubernetes Pod YAML for a container called `some-mariadb` .
    29  ```
    30  $ sudo podman generate kube some-mariadb
    31  # Generation of Kubenetes YAML is still under development!
    32  #
    33  # Save the output of this file and use kubectl create -f to import
    34  # it into Kubernetes.
    35  #
    36  # Created with podman-0.11.2-dev
    37  apiVersion: v1
    38  kind: Pod
    39  metadata:
    40    creationTimestamp: 2018-12-03T19:07:59Z
    41    labels:
    42      app: some-mariadb
    43    name: some-mariadb-libpod
    44  spec:
    45    containers:
    46    - command:
    47      - docker-entrypoint.sh
    48      - mysqld
    49      env:
    50      - name: PATH
    51        value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    52      - name: TERM
    53        value: xterm
    54      - name: HOSTNAME
    55      - name: container
    56        value: podman
    57      - name: GOSU_VERSION
    58        value: "1.10"
    59      - name: GPG_KEYS
    60        value: "199369E5404BD5FC7D2FE43BCBCB082A1BB943DB \t177F4010FE56CA3336300305F1656F24C74CD1D8
    61          \t430BDF5C56E7C94E848EE60C1C4CBDCDCD2EFD2A \t4D1BB29D63D98E422B2113B19334A25F8507EFA5"
    62      - name: MARIADB_MAJOR
    63        value: "10.3"
    64      - name: MARIADB_VERSION
    65        value: 1:10.3.10+maria~bionic
    66      - name: MYSQL_ROOT_PASSWORD
    67        value: x
    68      image: quay.io/baude/demodb:latest
    69      name: some-mariadb
    70      ports:
    71      - containerPort: 3306
    72        hostPort: 36533
    73        protocol: TCP
    74      resources: {}
    75      securityContext:
    76        allowPrivilegeEscalation: true
    77        privileged: false
    78        readOnlyRootFilesystem: false
    79      tty: true
    80      workingDir: /
    81  status: {}
    82  ```
    83  
    84  Create Kubernetes Pod YAML for a pod called `demoweb` and include a service.
    85  ```
    86  $ sudo podman generate kube -s demoweb
    87  # Generation of Kubernetes YAML is still under development!
    88  #
    89  # Save the output of this file and use kubectl create -f to import
    90  # it into Kubernetes.
    91  #
    92  # Created with podman-0.12.2-dev
    93  apiVersion: v1
    94  kind: Pod
    95  metadata:
    96    creationTimestamp: 2018-12-18T15:16:06Z
    97    labels:
    98      app: demoweb
    99    name: demoweb-libpod
   100  spec:
   101    containers:
   102    - command:
   103      - python3
   104      - /root/code/graph.py
   105      env:
   106      - name: PATH
   107        value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
   108      - name: TERM
   109        value: xterm
   110      - name: HOSTNAME
   111      - name: container
   112        value: podman
   113      image: quay.io/baude/demoweb:latest
   114      name: practicalarchimedes
   115      resources: {}
   116      securityContext:
   117        allowPrivilegeEscalation: true
   118        capabilities: {}
   119        privileged: false
   120        readOnlyRootFilesystem: false
   121      tty: true
   122      workingDir: /root/code
   123  status: {}
   124  ---
   125  apiVersion: v1
   126  kind: Service
   127  metadata:
   128    creationTimestamp: 2018-12-18T15:16:06Z
   129    labels:
   130      app: demoweb
   131    name: demoweb-libpod
   132  spec:
   133    ports:
   134    - name: "8050"
   135      nodePort: 31269
   136      port: 8050
   137      protocol: TCP
   138      targetPort: 0
   139    selector:
   140      app: demoweb
   141    type: NodePort
   142  status:
   143    loadBalancer: {}
   144  ```
   145  
   146  ## SEE ALSO
   147  podman(1), podman-container(1), podman-pod(1), podman-play-kube(1)
   148  
   149  ## HISTORY
   150  December 2018, Originally compiled by Brent Baude (bbaude at redhat dot com)