Considerations when deploying to Docker and Kubernetes

Localhost & Networking

docker network create my_test
docker run -d --name web1 --network=my_test web
docker run -d --name web2 --network=my_test web

Persistence

Configuration

Migration from Docker-Compose to Kubernetes

FROM ubuntu
RUN apt-get update && apt-get upgrade -y
RUN apt-get install nginx -y
RUN apt-get install curl -y
COPY index.html /var/www/html/
EXPOSE 80
CMD ["nginx","-g","daemon off;"]
version: '2'
services:
web1:
image: web
container_name: web1
ports:
- "8081:80"
web2:
image: web
container_name: web2
ports:
- "8082:80"
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: C:\Projects\_dev_tools\kompose\kompose.exe convert
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: web1
name: web1
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: web1
strategy: {}
template:
metadata:
annotations:
kompose.cmd: C:\Projects\_dev_tools\kompose\kompose.exe convert
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: web1
spec:
containers:
- image: web
imagePullPolicy: ""
name: web1
ports:
- containerPort: 80
resources: {}
restartPolicy: Always
serviceAccountName: ""
volumes: null
status: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: C:\Projects\_dev_tools\kompose\kompose.exe convert
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: web2
name: web2
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: web2
strategy: {}
template:
metadata:
annotations:
kompose.cmd: C:\Projects\_dev_tools\kompose\kompose.exe convert
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: web2
spec:
containers:
- image: web
imagePullPolicy: ""
name: web2
ports:
- containerPort: 80
resources: {}
restartPolicy: Always
serviceAccountName: ""
volumes: null
status: {}
---
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: C:\Projects\_dev_tools\kompose\kompose.exe convert
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: web1
name: web1
spec:
ports:
- name: "8081"
port: 8081
targetPort: 80
selector:
io.kompose.service: web1
status:
loadBalancer: {}
---
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: C:\Projects\_dev_tools\kompose\kompose.exe convert
kompose.version: 1.21.0 (992df58d8)
creationTimestamp: null
labels:
io.kompose.service: web2
name: web2
spec:
ports:
- name: "8082"
port: 8082
targetPort: 80
selector:
io.kompose.service: web2
status:
loadBalancer: {}

See Also

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store