Docker run to Kubernetes deployment yaml

8/7/2019

I have an application, which I deployed with docker run and it worked fine. Now I am trying to run that application on Kubernetes.

I have tried to build my deployment.yaml file but not able to complete it getting validation error.

Below is my docker run command

docker run -e LICENSE="accept" -d --name=container1 -p 10000:10000 -v /opt/app/install:/install/resources appCentre:6.0.0 appCentre_setup deploy_setup

and deployment.yaml file I am trying to build

apiVersion: apps/v1
kind: Deployment
metadata:
name: appCentre
labels:
    app: appCentre
spec:
replicas: 1
selector:
    matchLabels:
    app: appCentre
template:
    metadata:
    labels:
        app: appCentre
    spec:
        containers:
        - name: appCentre
            image: appCentre:6.0.0
            args:
            - "appCentre_setup"
            - "deploy_setup"
            ports:
            - containerPort: 10000
            volumnMounts:
                - name: volumn-app-appCentre
                mountPath: /install/resources
    volumns:
      - name: volumn-app-appCentre
        hostPath:
            path: /opt/app/install
            type: Directory

How can I proceed?

-- niting
docker
kubernetes
yaml

1 Answer

8/7/2019

The easiest way would be to generate the base yaml using:

kubectl run appCentre --image=appcentre:6.0.0 -l app=appCentre --expose --port=1000 --env=LICENSE="accept" --dry-run -o yaml

and then modify for your needs.

You should also check here as @mchawre point.

I hope this helps.

-- FL3SH
Source: StackOverflow