Getting Started
Welcome to the Kosko documentation! Before we start, make sure your computer meets the following system requirements.
- Node.js 18 or later.
Automatic Setup
It's recommended to setup a Kosko project with create-kosko command, which sets up basic folder structure and installs everything you need automatically.
- npm
- Yarn
- pnpm
npm init kosko@latest example
yarn create kosko@latest example
pnpm create kosko@latest example
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
- Yarn
- pnpm
npm install kosko @kosko/env kubernetes-models
yarn add kosko @kosko/env kubernetes-models
pnpm add kosko @kosko/env kubernetes-models
Create a new component with @kosko/template-deployed-service template.
- npm
- Yarn
- pnpm
npx @kosko/template-deployed-service --name nginx --image nginx
yarn dlx @kosko/template-deployed-service --name nginx --image nginx
pnpm dlx @kosko/template-deployed-service --name nginx --image nginx
Generate YAML
Run kosko generate to print Kubernetes manifests in the console.
- npm
- Yarn
- pnpm
npx kosko generate
yarn dlx kosko generate
pnpm dlx kosko generate
Pipe the output to kubectl to apply to a cluster.
- npm
- Yarn
- pnpm
npx kosko generate | kubectl apply -f -
yarn dlx kosko generate | kubectl apply -f -
pnpm dlx kosko generate | kubectl apply -f -
If you don't want to print manifests to console, run kosko validate.
- npm
- Yarn
- pnpm
npx kosko validate
yarn dlx kosko validate
pnpm dlx kosko validate
Related
📄️ 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.