Created
January 20, 2022 14:31
-
-
Save leadelngalame1611/a9eadf512eb023e29dae4a4c4771cef8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const appLabel = { app: "hello-kubernetes" }; | |
const deployment = { | |
apiVersion: "apps/v1", | |
kind: "Deployment", | |
metadata: { name: "hello-kubernetes" }, | |
spec: { | |
replicas: 3, | |
selector: { matchLabels: appLabel }, | |
template: { | |
metadata: { labels: appLabel }, | |
spec: { | |
containers: [ | |
{ | |
name: "hello-kubernetes", | |
image: "paulbouwer/hello-kubernetes:1.5", | |
ports: [ { containerPort: 8080 } ] | |
} | |
] | |
} | |
} | |
} | |
}; | |
const service = { | |
apiVersion: "v1", | |
kind: "Service", | |
metadata: { name: "hello-kubernetes" }, | |
spec: { | |
type: "LoadBalancer", | |
ports: [ { port: 80, targetPort: 8080 } ], | |
selector: appLabel | |
} | |
}; | |
// option 1: use a construct | |
new KubernetesResource(this, 'hello-kub', { | |
cluster, | |
manifest: [ deployment, service ] | |
}); | |
// or, option2: use `addResource` | |
cluster.addResource('hello-kub', service, deployment); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment