Create API Docker Image
Start course
Difficulty
Advanced
Duration
1h 26m
Students
1120
Ratings
4.7/5
starstarstarstarstar-half
Description

This training course is designed to help you master the skills of deploying cloud-native applications into Kubernetes.

Observe first hand the end-to-end process of deploying a sample cloud-native application into a Kubernetes cluster. By taking this course you'll not only get to see firsthand the skills required to perform a robust enterprise-grade deployment into Kubernetes, but you'll also be able to apply them yourself as all code and deployment assets are available for you to perform your own deployment:

https://github.com/cloudacademy/voteapp-frontend-react
https://github.com/cloudacademy/voteapp-api-go
https://github.com/cloudacademy/voteapp-k8s

Kubernetes Resources

This training course provides you with in-depth coverage and demonstrations of the following Kubernetes resources:

  1. Namespace
  2. Deployment/ReplicaSet
  3. Pod
  4. Service
  5. Ingress/Ingress Controller
  6. StatefulSet
    1. Persistent Volume
    2. Persistent Volume Claim
    3. Headless Service
  7. NetworkPolicy

Learning Objectives

What you'll learn:

  • Learn and understand the basic principles of deploying cloud-native applications into a Kubernetes cluster
  • Understand how to set up and configure a locally provisioned Kubernetes cluster using Minikube
  • Understand how to work with and configure many of the key Kubernetes cluster resources such as Pods, Deployments, Services, etc.
  • And finally, you’ll learn how to manage deployments and Kubernetes cluster resources through their full lifecycle.

Demonstration

This training course provides you with many hands-on demonstrations where you will observe first hand how to

  • Create and provision a Minikube Kubernetes cluster
  • Install the Cilium CNI plugin
  • Build and deploy Docker containers
  • Create and configure Kubernetes resources using kubectl

Prerequisites

  • A basic understanding of containers and containerization
  • A basic understanding of software development and the software development life cycle
  • A basic understanding of networks and networking

Intended Audience

  • Anyone interested in learning Kubernetes
  • Software Developers interested in Kubernetes containerization, orchestration, and scheduling
  • DevOps Practitioners
Transcript

- [Instructor] Okay, welcome back. In this feature, we'll compile and package the API Docker Image. 

This time we'll start by navigating into the "voteapp-api-go" directory which, contains all of the go based source code for our API. Here we'll then run the tree command to see its contents. Of note, are the go.mod and go.sun files, these are used by go to use and track the versions third-party libraries that our go API code pins on, and again acts as a safety net to ensure that the correct versions are downloaded each and every time and that we can perform reproducible and identical go builds. 

Okay, let's now compile our API, we do so by using the go build command to compile the API into an executable that has the name API and is compiled explicitly for the Linux operating system. This command will not only compile, but also download all the dependencies before compiling. If we now perform a directory listing in the current directory we should see our new API executable. The API executable needs to be packaged into a Docker image, again for this purpose we have a Docker file located in the project route. 

Let's take a look at it by running the command cat Docker file, now what should stick out about this Docker file as well as with the previous Docker file is its simplicity. We are simply deriving, from the alpine image, which is a very compact image. We then copy across the single API binary, and run it up exposing it on port 8080. 

Okay, let's now build and tag the API Docker image like so, giving it the tag "cloudacademy api v1." Again, if we reexamine the locale Docker images we should now see a new API Docker image, which we do, so again a great result. This now completes the build and packaging phase for the API and has put us in good shape to now progress to deploying out end to end sample cloud made application into the

About the Author
Students
126297
Labs
66
Courses
113
Learning Paths
180

Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.

He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, Azure, GCP), Security, Kubernetes, and Machine Learning.

Jeremy holds professional certifications for AWS, Azure, GCP, Terraform, Kubernetes (CKA, CKAD, CKS).