added kubeconfig code in the example + updated readme
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
54251f88b4
commit
abdcb7e093
@ -1,9 +1,12 @@
|
|||||||
# Kubernetes on AWS (EKS)
|
# Kubernetes on AWS (EKS)
|
||||||
|
|
||||||
|
This example creates a new EKS cluster and outputs its corresponding kubeconfig
|
||||||
|
|
||||||
## How to run
|
## How to run
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
dagger compute . \
|
dagger compute . \
|
||||||
--input-string awsConfig.accessKey="MY_AWS_ACCESS_KEY" \
|
--input-string awsConfig.accessKey="MY_AWS_ACCESS_KEY" \
|
||||||
--input-string awsConfig.secretKey="MY_AWS_SECRET_KEY"
|
--input-string awsConfig.secretKey="MY_AWS_SECRET_KEY" \
|
||||||
|
| jq -j '.kubeconfig.kubeconfig' > kubeconfig
|
||||||
```
|
```
|
||||||
|
@ -13,23 +13,23 @@ import (
|
|||||||
workerNodeCapacity: *3 | >=1
|
workerNodeCapacity: *3 | >=1
|
||||||
workerNodeInstanceType: *"t3.medium" | string
|
workerNodeInstanceType: *"t3.medium" | string
|
||||||
|
|
||||||
let clusterName = "\(namePrefix)eks-cluster"
|
clusterName: "\(namePrefix)eks-cluster"
|
||||||
|
|
||||||
eksControlPlane: cloudformation.#Stack & {
|
eksControlPlane: cloudformation.#Stack & {
|
||||||
config: awsConfig
|
config: awsConfig
|
||||||
source: json.Marshal(#CFNTemplate.eksControlPlane)
|
source: json.Marshal(#CFNTemplate.eksControlPlane)
|
||||||
stackName: "\(namePrefix)eks-controlplane"
|
stackName: "\(namePrefix)eks-controlplane"
|
||||||
neverUpdate: true
|
neverUpdate: true
|
||||||
timeout: 30
|
timeout: 30
|
||||||
parameters: ClusterName: clusterName
|
parameters: ClusterName: clusterName
|
||||||
}
|
}
|
||||||
|
|
||||||
eksNodeGroup: cloudformation.#Stack & {
|
eksNodeGroup: cloudformation.#Stack & {
|
||||||
config: awsConfig
|
config: awsConfig
|
||||||
source: json.Marshal(#CFNTemplate.eksNodeGroup)
|
source: json.Marshal(#CFNTemplate.eksNodeGroup)
|
||||||
stackName: "\(namePrefix)eks-nodegroup"
|
stackName: "\(namePrefix)eks-nodegroup"
|
||||||
neverUpdate: true
|
neverUpdate: true
|
||||||
timeout: 30
|
timeout: 30
|
||||||
parameters: {
|
parameters: {
|
||||||
ClusterName: clusterName
|
ClusterName: clusterName
|
||||||
NodeAutoScalingGroupDesiredCapacity: 1
|
NodeAutoScalingGroupDesiredCapacity: 1
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"dagger.io/aws"
|
"dagger.io/aws"
|
||||||
|
"dagger.io/aws/eks"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Fill using:
|
// Fill using:
|
||||||
@ -23,3 +24,8 @@ infra: #Infrastructure & {
|
|||||||
workerNodeCapacity: 1
|
workerNodeCapacity: 1
|
||||||
workerNodeInstanceType: "t3.small"
|
workerNodeInstanceType: "t3.small"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kubeconfig: eks.#KubeConfig & {
|
||||||
|
config: awsConfig
|
||||||
|
clusterName: infra.clusterName
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user