Домой United States USA — software Alexa and Kubernetes: Kubernetes Objects of the Alexa Skill (IV)

Alexa and Kubernetes: Kubernetes Objects of the Alexa Skill (IV)

245
0
ПОДЕЛИТЬСЯ

In this fourth installment, we will teach you how to create the Kubernetes objects you need to run the Alexa Skill in a cluster.
Join the DZone community and get the full member experience. In these steps, we have our Alexa Skill properly dockerized. As we are not going to package all the software components (Alexa Skill + MongoDB) yet, in this fourth step, we will set up all the Kubernetes objects of our Alexa Skill using MongoDB Atlas. Here, you have the technologies used in this project: The first thing we need to do is install a Kubernetes cluster on our local machine in order to create all the Kubernetes objects. For that, we are going to use Kind. Kind is a tool for running local Kubernetes clusters using Docker container “nodes.” Kind was primarily designed for testing Kubernetes itself but may be used for local development or CI. With Kind, you can create clusters using a specification YAML file. We can leverage Kind’s extraPortMapping configuration option when creating a cluster to forward ports from the host to an ingress controller running on a node. We will expose the port 80 of the Kind cluster to port 3008 of our local machine, and the 443 to the port 3009 of our local machine. This YAML file is located in the root folder called cluster.yaml. You can deploy the cluster running the following commands: If you want to destroy the cluster, just run the following command: The objects that we are going to create are the following Kubernetes objects so that we can run our Alexa Skill on Kubernetes: 1. Deployment: The deployment is one of the most important Kubernetes objects. A Deployment provides declarative updates for Pods. A Pod (as in a pod of whales or pea pod) is a group of one or more containers with shared storage and network resources and a specification for how to run the containers. 2. Service: An abstract way to expose an application running on a set of Pods as a network service. 3. Ingress: An API object that manages external access to the services in a cluster. It is a layer crated above the Kubernetes services. It requires an Ingress Controller to manage all the incoming requests.

Continue reading...