Deploy a Container Web App on Amazon EKS
GETTING STARTED GUIDE
Module 2: Install the CDK8s CLI
In this module, you will install the CDK8s command line tool and learn how to use it
In this module, you will set up AWS CDK for Kubernetes (CDK8s) as the main tool to define service and deployment for the application you will soon deploy. CDK8s is a completely separate tool, and needs to be installed in addition to CDK. The output from AWS CDK8s is a Kubernetes configuration file in Yaml that you can use to deploy applications using kubectl or AWS CDK. You will be using Python for this guide. CDK8s is a software development framework for defining Kubernetes applications and reusable abstractions using familiar programming languages and rich object-oriented APIs.
What You Will Learn
- Installing pipenv to bootstrap cdk8s application
- Installing CDK8s CLI
You will first need to install CDK8s via the following command:
npm install -g cdk8s-cli
The CDK8s uses pipenv for Python based projects. It consolidates and simplifies the Python development process to a single command line tool.
To install pipenv, you can use pip and run this command:
pip3 install pipenv
To create a CDK8s application, use the cdk8s init command. This command will generate a project skeleton that includes a Python environment and base libraries.
To create application, in the root folder (eks), use the following command:
cd cdk8s cdk8s init python-app
The CDK8s will create following files and folders structure:
├── Pipfile ├── Pipfile.lock ├── cdk8s.yaml ├── dist │ └── cdk8s.k8s.yaml ├── help ├── imports │ └── k8s │ ├── __init__.py │ ├── _jsii │ │ ├── __init__.py │ │ └── email@example.com │ └── py.typed └── main.py
You are now ready to start defining your application config to deploy it to the EKS cluster.