> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formae.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy an OKE Kubernetes cluster

> An OCI infrastructure pattern, deployed with formae.

A managed OKE (Oracle Kubernetes Engine) cluster with its networking and a node
pool. One forma provisions the VCN, an internet gateway, a NAT gateway, a service
gateway, a route table, subnets, and a security list, then the OKE cluster on that
network and a node pool inside the cluster.

```mermaid theme={"languages":{"custom":["/languages/pkl.json"]}}
flowchart LR
  target["oci-target"]:::tgt

  subgraph stack["oke-example"]
    direction LR
    vcn["VCN"]:::res
    igw["Internet gateway"]:::res
    nat["NAT gateway"]:::res
    svcgw["Service gateway"]:::res
    rt["Route table"]:::res
    subnets["Subnets"]:::res
    seclist["Security list"]:::res
    cluster["OKE cluster"]:::res
    nodepool["Node pool"]:::res

    vcn --> igw
    vcn --> nat
    vcn --> svcgw
    vcn --> rt
    vcn --> subnets
    vcn --> seclist
    subnets --> cluster
    vcn --> cluster
    cluster --> nodepool
  end

  target --> stack

  classDef tgt fill:#FF8201,stroke:#B25900,color:#ffffff
  classDef res fill:#FFF3E6,stroke:#FF8201,color:#02024B
  style stack fill:#ffffff,stroke:#02024B,stroke-width:2px,stroke-dasharray:6 4,color:#02024B
```

**Deploy.** Apply the example forma. formae provisions the network first, then the
cluster on it, then the node pool inside the cluster:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae apply --mode reconcile \
  /opt/pel/formae/examples/formae-plugin-oci/oke/main.pkl
```

**Verify.** Once the command completes, the cluster is under management:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae inventory resources --query="type:OCI::ContainerEngine::Cluster"
```

**Tear down.** The cluster has dependents, so cascade the destroy:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
formae destroy --on-dependents=cascade \
  /opt/pel/formae/examples/formae-plugin-oci/oke/main.pkl
```

The full forma is in the
[oke example](https://github.com/platform-engineering-labs/formae-plugin-oci/tree/main/examples/oke).
