Class KubernetesResource
(deprecated) Represents a resource within the Kubernetes system.
Inherited Members
Namespace: Amazon.CDK.AWS.EKS.Legacy
Assembly: Amazon.CDK.AWS.EKS.Legacy.dll
Syntax (csharp)
public class KubernetesResource : Construct, IConstruct, IDependable
Syntax (vb)
Public Class KubernetesResource
Inherits Construct
Implements IConstruct, IDependable
Remarks
Alternatively, you can use cluster.addResource(resource[, resource, ...])
to define resources on this cluster.
Applies/deletes the resources using kubectl
in sync with the resource.
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
Constructors
KubernetesResource(Construct, String, IKubernetesResourceProps) | |
KubernetesResource(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
KubernetesResource(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
RESOURCE_TYPE | (deprecated) The CloudFormation reosurce type. |
Constructors
KubernetesResource(Construct, String, IKubernetesResourceProps)
public KubernetesResource(Construct scope, string id, IKubernetesResourceProps props)
Parameters
- scope Construct
- id System.String
- props IKubernetesResourceProps
Remarks
Stability: Deprecated
KubernetesResource(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected KubernetesResource(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
KubernetesResource(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected KubernetesResource(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
RESOURCE_TYPE
(deprecated) The CloudFormation reosurce type.
public static string RESOURCE_TYPE { get; }
Property Value
System.String
Remarks
Stability: Deprecated