Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
This is the core library of Cloud Development Kit (CDK) for Kubernetes (cdk8s). cdk8s apps synthesize into standard Kubernetes manifests which can be applied to any Kubernetes cluster.
cdk8s (Cloud Development Kit for Kubernetes) is an open-source software development framework for defining Kubernetes applications and resources using familiar programming languages. It allows developers to use high-level constructs and abstractions to define Kubernetes manifests, making it easier to manage and deploy Kubernetes resources programmatically.
Defining Kubernetes Manifests
This code sample demonstrates how to define a Kubernetes Deployment manifest using cdk8s. It creates a deployment with 3 replicas of an NGINX container.
const cdk8s = require('cdk8s');
const { App, Chart } = cdk8s;
const k8s = require('cdk8s-plus-17');
const app = new App();
const chart = new Chart(app, 'MyChart');
new k8s.Deployment(chart, 'MyDeployment', {
spec: {
replicas: 3,
selector: {
matchLabels: { app: 'my-app' }
},
template: {
metadata: { labels: { app: 'my-app' } },
spec: {
containers: [{
name: 'my-app',
image: 'nginx'
}]
}
}
}
});
app.synth();
Using High-Level Constructs
This code sample shows how to use high-level constructs to define a Kubernetes Service manifest. It creates a LoadBalancer service that routes traffic to port 80 of the pods labeled with 'app: my-app'.
const cdk8s = require('cdk8s');
const { App, Chart } = cdk8s;
const k8s = require('cdk8s-plus-17');
const app = new App();
const chart = new Chart(app, 'MyChart');
new k8s.Service(chart, 'MyService', {
spec: {
type: 'LoadBalancer',
ports: [{ port: 80, targetPort: 80 }],
selector: { app: 'my-app' }
}
});
app.synth();
Composing Charts
This code sample demonstrates how to compose multiple Kubernetes resources into a single chart. It defines both a Deployment and a Service within a custom chart class.
const cdk8s = require('cdk8s');
const { App, Chart } = cdk8s;
const k8s = require('cdk8s-plus-17');
class MyChart extends Chart {
constructor(scope, id, props) {
super(scope, id, props);
new k8s.Deployment(this, 'MyDeployment', {
spec: {
replicas: 3,
selector: {
matchLabels: { app: 'my-app' }
},
template: {
metadata: { labels: { app: 'my-app' } },
spec: {
containers: [{
name: 'my-app',
image: 'nginx'
}]
}
}
}
});
new k8s.Service(this, 'MyService', {
spec: {
type: 'LoadBalancer',
ports: [{ port: 80, targetPort: 80 }],
selector: { app: 'my-app' }
}
});
}
}
const app = new App();
new MyChart(app, 'MyChart');
app.synth();
Pulumi is an infrastructure as code tool that allows you to define cloud resources using general-purpose programming languages. It supports Kubernetes and provides a similar approach to cdk8s by allowing you to define Kubernetes resources programmatically. However, Pulumi also supports other cloud providers like AWS, Azure, and Google Cloud, making it a more versatile tool for multi-cloud environments.
Helm is a package manager for Kubernetes that allows you to define, install, and upgrade complex Kubernetes applications using Helm charts. Unlike cdk8s, which uses programming languages to define resources, Helm uses YAML templates. Helm is widely adopted and has a large repository of pre-built charts, making it easier to deploy common applications.
Kustomize is a tool for customizing Kubernetes configurations. It allows you to define overlays to modify existing Kubernetes manifests without using templates. Kustomize is integrated into kubectl, making it a convenient option for Kubernetes users. Unlike cdk8s, Kustomize focuses on configuration management rather than programmatic resource definition.
⚠️ Version 1.x of the cdk8s toolchain is deprecated and will become end-of-life on 01/01/25. We strongly recommend migrating to
2.x
cdk8s is a software development framework for defining Kubernetes applications using rich object-oriented APIs. It allows developers to leverage the full power of software in order to define abstract components called "constructs" which compose Kubernetes resources or other constructs into higher-level abstractions.
Note: This repository is the "core library" of cdk8s, with logic for synthesizing Kubernetes manifests using the constructs framework. It is published to NPM as
cdk8s
and should not be confused with the cdk8s command-line toolcdk8s-cli
. For more general information about cdk8s, please see cdk8s.io, or visit the umbrella repository located at cdk8s-team/cdk8s.
See cdk8s.io.
This project is distributed under the Apache License, Version 2.0.
This module is part of the cdk8s project.
FAQs
This is the core library of Cloud Development Kit (CDK) for Kubernetes (cdk8s). cdk8s apps synthesize into standard Kubernetes manifests which can be applied to any Kubernetes cluster.
The npm package cdk8s receives a total of 98,443 weekly downloads. As such, cdk8s popularity was classified as popular.
We found that cdk8s demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.