Kubernetes Workload in AKS
This page shows how to deploy a Kubernetes workload on Azure Kubernetes Service (AKS) using the Fractal SDK.
For prerequisites, setup, and deployment file structure, see the main guide.
Java SDK
public static AzureKubernetesService getAksWithCustomWorkload(String id) {
return AzureKubernetesService.builder()
.withId(id)
.withRegion(EUROPE_WEST)
.withNodePools(getNodePools())
.withK8sWorkload(getK8sWorkload())
.build();
}
public static CaaSKubernetesWorkload getK8sWorkload() {
return CaaSKubernetesWorkload.builder()
.withId("fractal-samples")
.withDescription("Fractal Service on K8S")
.withNamespace("fractal")
.withSSHRepositoryURI("git@github.com:YanchWare/fractal-samples.git")
.withRepoId("YanchWare/fractal-samples")
.withBranchName("env/prod")
.withEnvironmentSecretShortName("my-secret-name") // Add secret access
// Optional: Use a specific CI/CD profile
//.withCiCdProfileShortName("my-other-cicd-profile")
.build();
}
public static Collection<? extends AzureNodePool> getNodePools() {
return List.of(
AzureNodePool.builder()
.withName("linuxdynamic")
.withMachineType(STANDARD_B2S)
.build()
);
}
For more details, see the Custom Workload in AKS sample on GitHub.
TypeScript SDK
import { AzureAksCluster, LiveSystem } from '@fractal_cloud/sdk';
const aksCluster = AzureAksCluster.getBuilder()
.withId('my-aks-cluster')
.withVersion(1, 0, 0)
.withDisplayName('AKS with Custom Workload')
.withKubernetesVersion('1.28.0')
.withManagedClusterSkuTier('standard')
.withNodePools([
{
name: 'linuxdynamic',
vmSize: 'Standard_B2s',
count: 1,
},
])
.withWorkloadIdentityEnabled(true)
.build();
For more details, see the TypeScript SDK samples on GitHub.