DEV Community

Cover image for Okteto-stacks - docker-compose batteries included
Ashok Nagaraj
Ashok Nagaraj

Posted on

Okteto-stacks - docker-compose batteries included

Okteto stacks extend docker-compose specification by adding new fields. Lot of them have been discussed in the previous post

services:
  api-backend:
    build: api-backend
    scale: 2
    ports:
      - 5000:5000

  redis-db:
    image: redis
    ports:
      - 6379
    volumes:
      - redis-db:/data

volumes:
  redis-db:/data
Enter fullscreen mode Exit fullscreen mode

This creates a 2-tier application with 2 instances of api-backend (on port 5000) connecting to one instance of redis-db(on port 6379) which is based on a volume-mount under /data
Translating it to kubernetes manifests would lead to a long manifest (>300 lines)

❯ kubectl get all
NAME                         READY   STATUS    RESTARTS   AGE
pod/redis-6fb6c999bd-hdvwt   1/1     Running   0          2m23s
pod/api-backend-7fb866df6c-cpbmw     1/1     Running   0          97s
pod/api-backend-7fb866df6c-vhkfp     1/1     Running   0          97s

NAME                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/kubernetes   ClusterIP   10.96.0.1       <none>        443/TCP    3m7s
service/redis        ClusterIP   10.96.185.225   <none>        6379/TCP   2m24s
service/api-backend          ClusterIP   10.96.214.56    <none>        5000/TCP   2m24s

NAME                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/redis   1/1     1            1           2m23s
deployment.apps/api-backend     2/2     2            2           97s

NAME                               DESIRED   CURRENT   READY   AGE
replicaset.apps/redis-6fb6c999bd   1         1         1       2m23s
replicaset.apps/api-backend-7fb866df6c     2         2         2       97s
Enter fullscreen mode Exit fullscreen mode
More info

Official documentation

Latest comments (0)