Interface IKubernetesResourceProps
Namespace: Amazon.CDK.AWS.EKS.Legacy
Assembly: Amazon.CDK.AWS.EKS.Legacy.dll
Syntax (csharp)
public interface IKubernetesResourceProps
Syntax (vb)
Public Interface IKubernetesResourceProps
Remarks
Stability: Deprecated
ExampleMetadata: infused
Examples
Cluster cluster;
IDictionary<string, string> appLabel = new Dictionary<string, string> { { "app", "hello-kubernetes" } };
IDictionary<string, object> deployment = new Dictionary<string, object> {
{ "apiVersion", "apps/v1" },
{ "kind", "Deployment" },
{ "metadata", new Dictionary<string, string> { { "name", "hello-kubernetes" } } },
{ "spec", new Dictionary<string, object> {
{ "replicas", 3 },
{ "selector", new Dictionary<string, IDictionary<string, string>> { { "matchLabels", appLabel } } },
{ "template", new Dictionary<string, IDictionary<string, IDictionary<string, string>>> {
{ "metadata", new Dictionary<string, IDictionary<string, string>> { { "labels", appLabel } } },
{ "spec", new Dictionary<string, IDictionary<string, object>[]> {
{ "containers", new [] { new Dictionary<string, object> {
{ "name", "hello-kubernetes" },
{ "image", "paulbouwer/hello-kubernetes:1.5" },
{ "ports", new [] { new Dictionary<string, int> { { "containerPort", 8080 } } } }
} } }
} }
} }
} }
};
IDictionary<string, object> service = new Dictionary<string, object> {
{ "apiVersion", "v1" },
{ "kind", "Service" },
{ "metadata", new Dictionary<string, string> { { "name", "hello-kubernetes" } } },
{ "spec", new Dictionary<string, object> {
{ "type", "LoadBalancer" },
{ "ports", new [] { new Dictionary<string, int> { { "port", 80 }, { "targetPort", 8080 } } } },
{ "selector", appLabel }
} }
};
// option 1: use a construct
// option 1: use a construct
new KubernetesResource(this, "hello-kub", new KubernetesResourceProps {
Cluster = cluster,
Manifest = new [] { deployment, service }
});
// or, option2: use `addResource`
cluster.AddResource("hello-kub", service, deployment);
Synopsis
Properties
Cluster | (deprecated) The EKS cluster to apply this configuration to. |
Manifest | (deprecated) The resource manifest. |
Properties
Cluster
(deprecated) The EKS cluster to apply this configuration to.
Cluster Cluster { get; }
Property Value
Remarks
[disable-awslint:ref-via-interface]
Stability: Deprecated
Manifest
(deprecated) The resource manifest.
object[] Manifest { get; }
Property Value
System.Object[]
Remarks
Consists of any number of child resources.
When the resource is created/updated, this manifest will be applied to the
cluster through kubectl apply
and when the resource or the stack is
deleted, the manifest will be deleted through kubectl delete
.
const manifest = {
apiVersion: 'v1',
kind: 'Pod',
metadata: { name: 'mypod' },
spec: {
containers: [ { name: 'hello', image: 'paulbouwer/hello-kubernetes:1.5', ports: [ { containerPort: 8080 } ] } ]
}
}
Stability: Deprecated