Hack Like ProIn-Depth ConceptsPremium

Simplifying Kubernetes With Docker Compose and Friends

2483

Today we’re happy to announce we’re open sourcing our support for using Docker Compose on Kubernetes. We’ve had this capability in Docker Enterprise for a little while but as of today, you will be able to use this on any Kubernetes cluster you choose.

Kubernetes Github

Why Do I Need Compose If I Already Have Kubernetes?

The Kubernetes API is really quite large. There are more than 50 first-class objects in the latest release, from Pods and Deployments to ValidatingWebhookConfiguration and ResourceQuota. This can lead to a verbosity in configuration, which then needs to be managed by you, the developer. Let’s look at a concrete example of that.

The Sock Shop is the canonical example of a microservices application. It consists of multiple services using different technologies and backends, all packaged up as Docker images. It also provides example configurations using different tools, including both Compose and raw Kubernetes configuration. Let’s have a look at the relative sizes of those configurations:

$ git clone https://github.com/microservices-demo/microservices-demo.git
$ cd deployment/kubernetes/manifests
$ (Get-ChildItem -Recurse -File | Get-Content | Measure-Object -line).Lines
908
$ cd ../../docker-compose
$ (Get-Content docker-compose.yml | Measure-Object -line).Lines
174

Describing the exact same multi-service application using just the raw Kubernetes objects takes more than 5 times the amount of configuration than with Compose. That’s not just an upfront cost to author — it’s also an ongoing cost to maintain. The Kubernetes API is amazingly general purpose — it exposes low-level primitives for building the full range of distributed systems. Compose, meanwhile, isn’t an API, but a high-level tool focused on developer productivity. That’s why combining them together makes sense. For the common case of a set of interconnected web services, Compose provides an abstraction that simplifies Kubernetes configuration. For everything else, you can still drop down to the raw Kubernetes API primitives. Let’s see all that in action.

First, we need to install the Compose on Kubernetes controller into your Kubernetes cluster. This controller uses the standard Kubernetes extension points to introduce the “Stack” to the Kubernetes API. You can use any Kubernetes cluster you like, but if you don’t already have one available then remember that Docker Desktop comes with Kubernetes and the Compose controller built-in, and enabling it is as simple as ticking a box in the settings.

To install the controller manually on any Kubernetes cluster, see the full documentation for the current installation instructions.

Next let’s write a simple Compose file:

version: "3.7"
services:
  web:
    image: dockerdemos/lab-web
    ports:
     - "33000:80"
  words:
    image: dockerdemos/lab-words
    deploy:
      replicas: 3
      endpoint_mode: dnsrr
  db:
    image: dockerdemos/lab-db

We’ll then use the docker client to deploy this to a Kubernetes cluster running the controller:

$ docker stack deploy --orchestrator=kubernetes -c docker-compose.yml words
Waiting for the stack to be stable and running...
db: Ready       [pod status: 1/1 ready, 0/1 pending, 0/1 failed]
web: Ready      [pod status: 1/1 ready, 0/1 pending, 0/1 failed]
words: Ready    [pod status: 1/3 ready, 2/3 pending, 0/3 failed]
Stack words is stable and running

We can then interact with those objects via the Kubernetes API. Here you can see we’ve created the lower-level objects like Services, Pods, Deployments and ReplicaSets automatically:

$ kubectl get all
NAME                       READY STATUSRESTARTS   AGE
pod/db-85849797f6-bhpm8    1/1 Running 0    57s
pod/web-7974f485b7-j7nvt   1/1 Running 0    57s
pod/words-8fd6c974-44r4s   1/1 Running 0    57s
pod/words-8fd6c974-7c59p   1/1 Running 0    57s
pod/words-8fd6c974-zclh5   1/1 Running 0    57s
NAME                    TYPE CLUSTER-IP      EXTERNAL-IP PORT(S)AGE
service/db              ClusterIPNone      <none>55555/TCP57s
service/kubernetes      ClusterIP10.96.0.1       <none>443/TCP4d
service/web             ClusterIPNone      <none>55555/TCP57s
service/web-published   LoadBalancer 10.102.236.49   localhost 33000:31910/TCP 57s
service/words           ClusterIPNone      <none>55555/TCP57s
NAME                    DESIRED CURRENT UP-TO-DATE   AVAILABLE AGE
deployment.apps/db      1 1 1        1 57s
deployment.apps/web     1 1 1        1 57s
deployment.apps/words   3 3 3        3 57s
NAME                             DESIRED CURRENT READY AGE
replicaset.apps/db-85849797f6    1 1 1 57s
replicaset.apps/web-7974f485b7   1 1 1 57s
replicaset.apps/words-8fd6c974   3 3 3 57s

It’s important to note that this isn’t a one-time conversion. The Compose on Kubernetes API Server introduces the Stack resource to the Kubernetes API. So we can query and manage everything at the same level of abstraction as we’re building the application. That makes delving into the details above useful for understanding how things work, or debugging issues, but not required most of the time:

$ kubectl get stack
NAME      STATUS  PUBLISHED PORTS   PODS AGE 
words     Running 33000     5/54m

Integration with Other Kubernetes Tools

Because Stack is now a native Kubernetes object, you can work with it using other Kubernetes tools. As an example, save the as “stack.yaml“:

kind: Stack
apiVersion: compose.docker.com/v1beta2
metadata:
 name: hello
spec:
 services:
 - name: hello
   image: garethr/skaffold-example
   ports:
   - mode: ingress
     target: 5678
     published: 5678
     protocol: tcp

You can use a tool like Skaffold to have the image automatically rebuild and the Stack automatically redeployed whenever you change any of the details of your application. This makes for a great local inner-loop development experience. The following skaffold.yamlconfiguration file is all you need.

apiVersion: skaffold/v1alpha5
kind: Config
build:
 tagPolicy:
   sha256: {}
 artifacts:
 - image: garethr/skaffold-example
 local:
   useBuildkit: true
deploy:
 kubectl:
   manifests:
     - stack.yaml

The Future

We already have some thoughts about a Helm plugin to make describing your application with Compose and deploying with Helm as easy as possible. We have lots of other ideas for helping to simplify the developer experience of working with Kubernetes too, without losing any of the power of the platform. We also want to work with the wider Cloud Native community, so if you have ideas and suggestions please let us know.

Kubernetes is designed to be extended, and we hope you like what we’ve been able to release today. If you’re one of the millions of Compose users you can now more easily move to and manage your applications on Kubernetes. If you’re a Kubernetes user struggling with too much low-level configuration then give Compose a try. Let us know in the comments what you think, and head over to GitHub to try things out and even open your first PR:

Thanks Tech And Security For Giving Me Chance To Write On Your Website.

If You Want To Show Your Aticle On Our Website. Just Mail Your Content With Your NAME And BIO On “[email protected]

Super User – Tech and Security
Lovepreet Singh
CEO & FOUNDER OF" FIVE RIVERS INCORPORATION - LEADING SOFTWARE & CYBER SECURITY DEVELOPMENT COMPANY" || CERTIFIED ETHICAL HACKER || FUTURE TRILLIONAIRE || FUTURISTIC || "DULL SCHOOL STUDENT" || (Follow this link to message me on WhatsApp: https://wa.me/13018426470)

Web Browser Address Bar Spoofing

Previous article

How to Hack WiFi Password Easily Using New Attack On WPA/WPA2

Next article

You may also like

2,483 Comments

  1. [url=https://wellbutrin300.com/]wellbutrin[/url] [url=https://atarax10.com/]atarax 25mg tab[/url] [url=https://atenolol25.com/]atenolol 50 mg[/url] [url=https://vardenafilbuy.com/]purchase vardenafil[/url] [url=https://allopurinolzyloprim.com/]allopurinol[/url] [url=https://femaleviagra24.com/]women cialis[/url] [url=https://levitrasale.com/]cheep levitra for sale[/url] [url=https://generictadalafil20mg.com/]buy cheap tadalafil[/url] [url=https://sildalis120.com/]sildalis[/url] [url=https://hydrochlorothiazide25.com/]hydrochlorothiazide 12.5mg[/url]

  2. [url=https://homeworks.us.com/]we do your homework[/url] [url=https://buyessayonline.us.com/]buy essay online[/url]

  3. [url=https://femaleviagra24.com/]female viagra uk[/url] [url=https://sildalis120.com/]generic sildalis[/url] [url=https://generictadalafil20mg.com/]tadalafil generic[/url] [url=https://lisinoprilbuy.com/]lisinopril drug[/url] [url=https://atenolol25.com/]atenolol 50 mg[/url]

  4. [url=http://homeworks.us.com/]homework help online chat[/url]

  5. [url=https://paydayloansonline.us.com/]online payday loans direct lenders[/url] [url=https://badcredit.us.org/]loans for people with bad credit[/url] [url=https://moneyfast.us.org/]money fast[/url] [url=https://lending.us.org/]payday loans direct lenders[/url] [url=https://simpleloan.us.org/]simple loan[/url]

  6. [url=https://levitrasale.com/]levitra[/url] [url=https://generictadalafil20mg.com/]tadalafil citrate[/url] [url=https://cafergot100.com/]cafergot[/url] [url=https://buydiflucan.com/]buy diflucan[/url]

  7. [url=https://badcredit.us.org/]bad credit loans[/url] [url=https://lender.us.org/]payday loans utah[/url] [url=https://paydayloansonline.us.com/]installment loans for poor credit[/url] [url=https://lending.us.org/]installment sale[/url] [url=https://moneyfast.us.org/]money fast[/url]

  8. [url=https://azithromycin100.com/]azithromycin 500 mg[/url] [url=https://allopurinolzyloprim.com/]allopurinol[/url] [url=https://doxycycline02.com/]buy doxycycline 100mg[/url] [url=https://femaleviagra24.com/]female viagra[/url] [url=https://lisinoprilbuy.com/]lisinopril cost[/url] [url=https://tetracycline365.com/]tetracycline buy[/url] [url=https://atenolol25.com/]atenolol 25mg tablets[/url] [url=https://hydrochlorothiazide25.com/]hydrochlorothiazide 25[/url] [url=https://sildalis120.com/]sildalis[/url] [url=https://atarax10.com/]generic for atarax[/url]

  9. [url=https://allopurinolzyloprim.com/]allopurinol online purchase[/url] [url=https://hydrochlorothiazide25.com/]hydrochlorothiazide 25 mg[/url]

  10. [url=https://sildenafil1000.com/]sildenafil over counter[/url] [url=https://atarax10.com/]atarax[/url] [url=https://generictadalafil20mg.com/]tadalafil[/url] [url=https://xenical120mg.com/]xenical[/url] [url=https://wellbutrin300.com/]wellbutrin xl 300[/url] [url=https://tetracycline365.com/]tetracycline[/url] [url=https://allopurinolzyloprim.com/]cost of allopurinol[/url] [url=https://zoviraxacyclovir.com/]acyclovir[/url] [url=https://hydrochlorothiazide25.com/]hydrochlorothiazide 25 mg[/url] [url=https://sildalis120.com/]sildalis buy[/url] [url=https://atenolol25.com/]atenolol[/url] [url=https://doxycycline02.com/]doxycycline[/url] [url=https://buydiflucan.com/]buy diflucan[/url] [url=https://cafergot100.com/]generic cafergot[/url] [url=https://femaleviagra24.com/]cheap female viagra[/url]

  11. [url=http://tetracycline365.com/]tetracycline[/url] [url=http://atenolol25.com/]50 mg atenolol[/url] [url=http://levitrasale.com/]levitra buy[/url] [url=http://hydrochlorothiazide25.com/]hydrochlorothiazide 25[/url] [url=http://xenical120mg.com/]xenical[/url] [url=http://cafergot100.com/]generic cafergot[/url] [url=http://doxycycline02.com/]buying doxycycline online[/url] [url=http://femaleviagra24.com/]female viagra 100mg[/url] [url=http://generictadalafil20mg.com/]tadalafil[/url] [url=http://sildalis120.com/]sildalis[/url] [url=http://azithromycin100.com/]azithromycin 250 mg tablets[/url] [url=http://lisinoprilbuy.com/]lisinopril 20mg tablets[/url] [url=http://sildenafil1000.com/]viagra sildenafil[/url] [url=http://vardenafilbuy.com/]where to buy vardenafil[/url] [url=http://buydiflucan.com/]where can i buy diflucan[/url]

  12. [url=http://femaleviagra24.com/]buy female viagra[/url] [url=http://hydrochlorothiazide25.com/]hydrochlorothiazide 125mg[/url] [url=http://cafergot100.com/]cafergot[/url] [url=http://levitrasale.com/]buy generic levitra online[/url] [url=http://wellbutrin300.com/]wellbutrin xl 150 mg[/url]

  13. [url=http://femaleviagra24.com/]female viagara[/url] [url=http://cafergot100.com/]cafergot[/url] [url=http://atenolol25.com/]buy atenolol[/url] [url=http://levitrasale.com/]levitra for sale[/url]

  14. [url=http://atenolol25.com/]atenolol 50 mg[/url] [url=http://atarax10.com/]atarax pill[/url] [url=http://wellbutrin300.com/]wellbutrin 150 xl[/url] [url=http://femaleviagra24.com/]female viagra[/url] [url=http://doxycycline02.com/]order doxycycline online[/url]

  15. [url=https://femaleviagra24.com/]female viagra[/url] [url=https://levitrasale.com/]buy levitra online[/url] [url=https://vardenafilbuy.com/]vardenafil buy online[/url] [url=https://atarax10.com/]generic for atarax[/url] [url=https://tetracycline365.com/]tetracycline antibiotic[/url] [url=https://doxycycline02.com/]doxcyclene[/url] [url=https://wellbutrin300.com/]wellbutrin generic cost[/url] [url=https://generictadalafil20mg.com/]tadalafil price[/url] [url=https://hydrochlorothiazide25.com/]hydrochlorothiazide brand name[/url] [url=https://buydiflucan.com/]buy fluconazol without prescription[/url]

  16. [url=https://tetracycline365.com/]order antibiotics tetracycline no prescription[/url] [url=https://azithromycin100.com/]azithromycin[/url] [url=https://wellbutrin300.com/]150 mg wellbutrin[/url] [url=https://buydiflucan.com/]diflucan 150 mg tablets[/url]

  17. [url=https://azithromycin100.com/]azithromycin 500 dosage online pharmacy[/url] [url=https://doxycycline02.com/]doxycycline[/url] [url=https://xenical120mg.com/]buy over the counter xenical[/url]

  18. [url=http://buyessayonline.us.com/]buy essays online[/url]

  19. [url=https://sildalis120.com/]generic sildalis[/url] [url=https://allopurinolzyloprim.com/]allopurinol over the counter[/url] [url=https://atarax10.com/]atarax[/url] [url=https://generictadalafil20mg.com/]tadalafil tablets 20 mg[/url] [url=https://cafergot100.com/]buy cafergot online[/url] [url=https://atenolol25.com/]cheap atenolol[/url] [url=https://zoviraxacyclovir.com/]acyclovir buy online[/url] [url=https://vardenafilbuy.com/]buy vardenafil cheap[/url]

  20. [url=http://wellbutrin300.com/]wellbutrin no precription[/url]

  21. [url=https://wellbutrin300.com/]wellbutrin sr 150mg[/url] [url=https://tetracycline365.com/]tetracycline[/url] [url=https://vardenafilbuy.com/]vardenafil buy[/url] [url=https://atarax10.com/]atarax[/url] [url=https://sildenafil1000.com/]sildenafil[/url] [url=https://doxycycline02.com/]doxy[/url] [url=https://buydiflucan.com/]diflucan buy[/url] [url=https://zoviraxacyclovir.com/]acyclovir 500 mg[/url] [url=https://levitrasale.com/]levitra 10 mg price[/url] [url=https://hydrochlorothiazide25.com/]hydrochlorothiazide 25[/url]

  22. [url=http://lender.us.org/]cash lenders[/url]

  23. [url=http://azithromycin100.com/]azithromycin 500[/url] [url=http://levitrasale.com/]levitra[/url] [url=http://sildenafil1000.com/]sildenafil[/url] [url=http://tetracycline365.com/]buy tetracycline antibiotics[/url] [url=http://cafergot100.com/]cafergot online[/url] [url=http://lisinoprilbuy.com/]lisinopril 20mg[/url] [url=http://atarax10.com/]atarax online[/url] [url=http://femaleviagra24.com/]female viagra[/url] [url=http://hydrochlorothiazide25.com/]hydrochlorothiazide 25[/url] [url=http://sildalis120.com/]generic sildalis[/url]

  24. [url=https://femaleviagra24.com/]female viagra cheap[/url] [url=https://doxycycline02.com/]cost of doxycycline[/url] [url=https://zoviraxacyclovir.com/]buy acyclovir with no prescription[/url] [url=https://sildalis120.com/]sildalis online[/url] [url=https://lisinoprilbuy.com/]cost of lisinopril[/url] [url=https://generictadalafil20mg.com/]tadalafil without prescription[/url] [url=https://wellbutrin300.com/]wellbutrin xl 300mg[/url] [url=https://atarax10.com/]atarax 25mg tab[/url]

  25. [url=https://hydrochlorothiazide25.com/]hydrochlorothiazide 125mg[/url] [url=https://atarax10.com/]atarax[/url] [url=https://azithromycin100.com/]azithromycin[/url] [url=https://zoviraxacyclovir.com/]purchase acyclovir[/url] [url=https://doxycycline02.com/]where can i buy doxycycline[/url] [url=https://femaleviagra24.com/]where to buy female viagra[/url] [url=https://wellbutrin300.com/]wellbutrin[/url] [url=https://sildalis120.com/]generic sildalis[/url] [url=https://vardenafilbuy.com/]vardenafil buy online[/url] [url=https://xenical120mg.com/]buy cheap xenical[/url] [url=https://generictadalafil20mg.com/]tadalafil[/url] [url=https://sildenafil1000.com/]buy sildenafil citrate 100mg[/url] [url=https://levitrasale.com/]levitra pills online[/url] [url=https://buydiflucan.com/]diflucan buy[/url] [url=https://lisinoprilbuy.com/]buy lisinopril[/url]

  26. [url=https://paydayloansonline.us.com/]loans net[/url] [url=https://moneyfast.us.org/]mobile loans[/url] [url=https://simpleloan.us.org/]easy money payday loans[/url] [url=https://badcredit.us.org/]bad credit loans[/url] [url=https://lender.us.org/]payday lenders[/url]

  27. [url=https://atarax10.com/]atarax[/url] [url=https://zoviraxacyclovir.com/]buy valacyclovir online[/url]

  28. [url=https://doxycycline02.com/]doxy 100[/url] [url=https://sildalis120.com/]buy sildalis[/url] [url=https://generictadalafil20mg.com/]buy tadalafil[/url] [url=https://xenical120mg.com/]buy xenical cheap[/url] [url=https://zoviraxacyclovir.com/]acyclovir[/url] [url=https://lisinoprilbuy.com/]lisinopril price[/url] [url=https://atenolol25.com/]atenolol 25mg[/url] [url=https://cafergot100.com/]ordering cafegot[/url] [url=https://sildenafil1000.com/]buy sildenafil citrate online[/url] [url=https://azithromycin100.com/]azithromycin buy[/url]

  29. [url=https://sildalis120.com/]sildalis[/url] [url=https://wellbutrin300.com/]wellbutrin[/url] [url=https://hydrochlorothiazide25.com/]hydrochlorothiazide 25[/url] [url=https://zoviraxacyclovir.com/]buy acyclovir cheap[/url] [url=https://lisinoprilbuy.com/]lisinopril 20 mg no prescription[/url] [url=https://sildenafil1000.com/]where to buy sildenafil[/url] [url=https://cafergot100.com/]cafergot[/url] [url=https://atenolol25.com/]atenolol 50 mg[/url] [url=https://allopurinolzyloprim.com/]buy allopurinol online[/url] [url=https://azithromycin100.com/]azithromycin 500 mg tablets[/url]

  30. [url=http://hydrochlorothiazide25.com/]hydrochlorothiazide 25 mg[/url] [url=http://xenical120mg.com/]buy orlistat[/url] [url=http://sildenafil1000.com/]sildenafil[/url] [url=http://wellbutrin300.com/]wellbutrin[/url] [url=http://allopurinolzyloprim.com/]cost of allopurinol[/url] [url=http://levitrasale.com/]canadian levitra[/url] [url=http://zoviraxacyclovir.com/]acyclovir without prescription[/url] [url=http://atenolol25.com/]atenolol 50 mg tablets[/url] [url=http://doxycycline02.com/]doxycycline cost[/url] [url=http://tetracycline365.com/]tetracycline drugs[/url] [url=http://cafergot100.com/]buy cafergot online[/url] [url=http://lisinoprilbuy.com/]lisinopril price[/url] [url=http://sildalis120.com/]buy sildalis[/url] [url=http://azithromycin100.com/]azithromycin[/url] [url=http://femaleviagra24.com/]buy female viagra[/url]

  31. [url=http://lender.us.org/]loan lenders[/url] [url=http://moneyfast.us.org/]personal loans with no collateral[/url] [url=http://simpleloan.us.org/]personal loan rates[/url] [url=http://badcredit.us.org/]loan bad credit[/url]

  32. [url=https://azithromycin100.com/]azithromycin[/url] [url=https://atenolol25.com/]atenolol 50 mg tab[/url] [url=https://tetracycline365.com/]buy tetracycline online without a prescription from canada[/url] [url=https://wellbutrin300.com/]generic for wellbutrin[/url] [url=https://doxycycline02.com/]buy doxycycline 100mg[/url]

  33. [url=https://vardenafilbuy.com/]buy vardenafil canada[/url]

Leave a reply

Your email address will not be published. Required fields are marked *