Getting Started
Welcome to the Kosko documentation! Before we start, make sure your computer meets the following system requirements.
- Node.js 18 or later.
Install
First, install Kosko globally.
npm install kosko -g
If the following error occurred during installation.
Error: EACCES: permission denied
Try running npm install
again with sudo
.
sudo npm install kosko -g
Or, you can skip global installation and run kosko
with npx
.
npx kosko
Automatic Setup
It's recommended to setup a Kosko project with kosko init
command, which sets up basic folder structure and installs everything you need automatically.
kosko init example
We also recommend using TypeScript, which can improve user experience in IDE and make debugging much easier. To set up a TypeScript project, run:
kosko init example --typescript
After installation complete, the command will generate following files in example
folder.
.
├── README.md
├── components
│ └── nginx.js
├── environments
│ └── dev
│ ├── index.js
│ └── nginx.js
├── kosko.toml
├── package-lock.json
└── package.json
Manual Setup
Install kosko
, @kosko/env
and kubernetes-models
.
npm install kosko @kosko/env kubernetes-models
Create a new component with @kosko/template-deployed-service
template.
npx @kosko/template-deployed-service --name nginx --image nginx
Generate YAML
Run kosko generate
to print Kubernetes manifests in the console.
kosko generate
Pipe the output to kubectl to apply to a cluster.
kosko generate | kubectl apply -f -
If you don't want to print manifests to console, run kosko validate
.
kosko validate
Learn More
📄️ Components
A component is a collection of Kubernetes manifests including all resources needed for an application, such as a Deployment, a Service or a Secret.
📄️ Environments
Environments are variables specific to different clusters or namespaces.