The best way to control Claude Code, Codex and more from any computer or phone
| 1 | # @alchemy.run/kubernetes |
| 2 | |
| 3 | Kubernetes for [Alchemy](https://alchemy.run). Declare Deployments, Jobs, raw manifests, and Helm charts on any cluster, in the same TypeScript program as the rest of your infrastructure. No YAML, no `kubectl apply`. |
| 4 | |
| 5 | ```sh |
| 6 | npm install alchemy @alchemy.run/kubernetes effect |
| 7 | ``` |
| 8 | |
| 9 | A local cluster and a Deployment on it: |
| 10 | |
| 11 | ```typescript |
| 12 | // alchemy.run.ts |
| 13 | import * as Alchemy from "alchemy"; |
| 14 | import * as Kubernetes from "@alchemy.run/kubernetes"; |
| 15 | import * as Effect from "effect/Effect"; |
| 16 | |
| 17 | export default Alchemy.Stack( |
| 18 | "MyApp", |
| 19 | { |
| 20 | providers: Kubernetes.providers(), |
| 21 | state: Alchemy.localState(), |
| 22 | }, |
| 23 | Effect.gen(function* () { |
| 24 | const cluster = yield* Kubernetes.LocalCluster("Cluster", { name: "alchemy" }); |
| 25 | |
| 26 | const web = yield* Kubernetes.Deployment("Web", { |
| 27 | cluster, |
| 28 | name: "web", |
| 29 | image: "ghcr.io/stefanprodan/podinfo:6.15.0", |
| 30 | port: 9898, |
| 31 | replicas: 2, |
| 32 | }); |
| 33 | |
| 34 | return { service: web.serviceName }; |
| 35 | }), |
| 36 | ); |
| 37 | ``` |
| 38 | |
| 39 | Swap `LocalCluster` for an EKS cluster from `@alchemy.run/aws` or a GKE cluster from `@alchemy.run/gcp` and the Deployment stays the same. |
| 40 | |
| 41 | ## Learn more |
| 42 | |
| 43 | - [Kubernetes on alchemy.run](https://alchemy.run/kubernetes) |
| 44 | - [Setup](https://alchemy.run/kubernetes/setup) |
| 45 | - [Tutorial](https://alchemy.run/kubernetes/tutorial/part-1) |
| 46 | - [API reference](https://alchemy.run/providers) |