DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Nexus Reference Platform: Docker Stack and Kubernetes

Nexus Reference Platform: Docker Stack and Kubernetes

Take a look at how this developer was able to use Docker Desktop to bring his entire reference platform to a local Kubernetes instance.

Curtis Yanko user avatar by
Curtis Yanko
·
Sep. 17, 18 · Tutorial
Like (1)
Save
Tweet
Share
3.91K Views

Join the DZone community and get the full member experience.

Join For Free

For a little over a year now I've been using Docker to help me manage my local demo environment. It has also helped me in my workshops by making it easy for any participant to get our platform up and running regardless of what laptop they brought with them. I first shared this in a blog last December entitled, Docker Compose for the Nexus Platform - Part 1. Then in February, I added an NGINX server to the mix to offload SSL and at the same time added some basic provisioning examples in Running The Nexus Platform Behind NGINX Using Docker. Last July, Docker Desktop brought support for a certified Kubernetes implementation to the stable channel! This was a big deal for me because it meant I no longer had to try and manage a separate installation of mini-kube; it was now all a part of the package.

I found this blog with a tutorial for getting started that help me get a Kubernetes dashboard installed and confirmed that everything was working for me. Very exciting, now all I had to do was figure out how to move my reference platform into Kubernetes. Turns out the team at Docker were one step ahead of me: they had been positioning docker-compose, v3, files just for this purpose along with a new tool, Docker Stack. A few keyword offerings to Google helped me find this blog post: Docker Compose and Kubernetes With Docker For Desktop.

Holy cow, you mean all I have to do is run a Docker Stack command and the whole reference platform will be running in my local Kubernetes instance? To the terminal!


Logging into the dashboard we can see all the elements created by the stack.


When we look at the services we see an interesting pattern. Docker Stack has created two services for each Pod, one for external routes, the ones with "publisher" in the name, and another for internal, pod-to-pod communications.


Wow! Those 30 lines of the docker-compose file are sure a lot easier than creating a half dozen, or so, YML files for Kubernetes. Which we can easily see by looking in the dashboard.


If I scroll down there are ~140 lines in the definition of just that one pod. But now we have a working example along with examples of annotations.

Docker Stack does ignore the "build" directive in docker-compose files so you might have to run a docker-compose build prior to running Docker Stack if you haven't already built the two custom images I use.

To stop the whole thing just use  docker stack rm demoenv . This will stop all of the services and remove the pods and deployments completely removing the whole stack from my Kubernetes environment. Now that's easy.

I'm amazed by how seamlessly everything moved over including binding exposed ports to localhost as an endpoint. This meant that everything worked for me exactly as it had before with my etc/hosts entries allowing me to hit the NGINX instance and get routed to the right pod.

There is still plenty of work to do, like changing the local persistent volume to one declared in Kubernetes, but this is a huge step forward by the Docker team to better align the ways devs work to how it will be done in operation. I look forward to seeing how Docker Stacks continue to evolve. In the next blog, we'll take a look at a shortcut to creating the Kubernetes YML files from the docker-compose file without using Docker Stack.

Docker (software) Kubernetes Nexus (standard)

Published at DZone with permission of Curtis Yanko, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • HTTP vs Messaging for Microservices Communications
  • Application Architecture Design Principles
  • NoSQL vs SQL: What, Where, and How
  • Spring Boot, Quarkus, or Micronaut?

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: