2019-10-16 13:05:14 -07:00
|
|
|
---
|
2023-06-02 21:41:36 -07:00
|
|
|
title_tag: Kubernetes Managed Infrastructure Services | Crosswalk
|
2019-12-18 09:59:20 -08:00
|
|
|
meta_desc: This page provides an overview of Managed Infrastructure services that
|
|
|
|
support and complement Kubernetes clusters and workloads.
|
2023-05-15 15:25:28 -07:00
|
|
|
title: Infra services
|
|
|
|
h1: Kubernetes infrastructure services
|
2023-06-08 16:15:52 -07:00
|
|
|
meta_image: /images/docs/meta-images/docs-clouds-kubernetes-meta-image.png
|
2023-05-15 15:25:28 -07:00
|
|
|
menu:
|
|
|
|
clouds:
|
|
|
|
parent: kubernetes-guides
|
|
|
|
weight: 13
|
|
|
|
aliases:
|
|
|
|
- /docs/guides/crosswalk/kubernetes/managed-infra/
|
2019-10-16 13:05:14 -07:00
|
|
|
---
|
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{< chooser cloud "aws,azure,gcp" / >}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% choosable cloud aws %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-16 13:05:14 -07:00
|
|
|
AWS has a catalog of [managed infrastructure][aws-managed-svcs] services that
|
|
|
|
support and complement Kubernetes clusters and their workloads.
|
|
|
|
|
|
|
|
At a minimum, networking must be configured for deployment of an EKS cluster.
|
|
|
|
|
|
|
|
AWS exposes a [Virtual Private Cloud][aws-vpc] API which can be used to create
|
|
|
|
resources into a virtual network. With the VPC you can define the region's [Availability
|
|
|
|
Zones][aws-azs] to use, alongwith [Route Tables][aws-rts], [Subnets][aws-subnets], [Internet Gateways][aws-igw],
|
|
|
|
[NAT Gateways][aws-ngw] and [Security Groups][aws-sgs].
|
|
|
|
|
2019-10-16 19:52:45 -07:00
|
|
|
The full code for this stack is on [GitHub][gh-repo-stack].
|
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
<!-- markdownlint-disable url -->
|
2019-11-13 09:53:50 -08:00
|
|
|
[gh-repo-stack]: https://github.com/pulumi/kubernetes-guides/tree/master/aws/02-managed-infra
|
2023-05-15 15:25:28 -07:00
|
|
|
[crosswalk-aws]: /docs/clouds/aws/guides/
|
2019-10-16 19:52:45 -07:00
|
|
|
[aws-managed-svcs]: https://aws.amazon.com/products/
|
|
|
|
[aws-vpc]: https://aws.amazon.com/vpc/
|
|
|
|
[aws-azs]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
|
|
|
|
[aws-rts]: https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html
|
|
|
|
[aws-subnets]: https://docs.aws.amazon.com/vpc/latest/userguide/working-with-vpcs.html
|
|
|
|
[aws-igw]: https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html
|
|
|
|
[aws-ngw]: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html
|
|
|
|
[aws-sgs]: https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html
|
2019-12-18 09:59:20 -08:00
|
|
|
<!-- markdownlint-enable url -->
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
|
|
|
|
|
|
|
{{% choosable cloud azure %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-28 21:10:01 -07:00
|
|
|
Azure has a catalog of [managed infrastructure][azure-managed-svcs] services that
|
|
|
|
support and complement Kubernetes clusters and their workloads.
|
|
|
|
|
|
|
|
At a minimum, networking must be configured for deployment of an AKS cluster.
|
|
|
|
|
|
|
|
AWS exposes a [Virtual Network][azure-vpc] API which can be used to create
|
|
|
|
resources into a virtual network. With the VPC you can define
|
|
|
|
use, alongwith [Route Tables][azure-rts], [Subnets][azure-subnets],
|
|
|
|
[Security Groups][azure-sgs] and [VPN Gateways][azure-vpn-gw].
|
2019-10-16 19:52:45 -07:00
|
|
|
|
|
|
|
The full code for this stack is on [GitHub][gh-repo-stack].
|
|
|
|
|
2019-10-28 21:10:01 -07:00
|
|
|
[azure-managed-svcs]: https://azure.microsoft.com/en-us/services/
|
|
|
|
[azure-vpc]: https://azure.microsoft.com/en-us/services/
|
|
|
|
[azure-subnets]: https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-vnet-plan-design-arm#subnets
|
|
|
|
[azure-rts]: https://docs.microsoft.com/en-us/azure/virtual-network/virtual-networks-udr-overview#user-defined
|
|
|
|
[azure-sgs]: https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-vnet-plan-design-arm#security
|
|
|
|
[azure-vpn-gw]: https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-vnet-vnet-rm-ps
|
2019-11-13 09:53:50 -08:00
|
|
|
[gh-repo-stack]: https://github.com/pulumi/kubernetes-guides/tree/master/azure/02-managed-infra
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
|
|
|
|
|
|
|
{{% choosable cloud gcp %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2023-05-15 15:25:28 -07:00
|
|
|
Google Cloud has a catalog of [managed infrastructure][gcp-managed-svcs] services that
|
2019-10-30 12:20:26 -07:00
|
|
|
support and complement Kubernetes clusters and their workloads.
|
|
|
|
|
|
|
|
At a minimum, networking must be configured for deployment of an EKS cluster.
|
|
|
|
|
2023-05-15 15:25:28 -07:00
|
|
|
Google Cloud exposes a [Virtual Private Cloud][gcp-vpc] API which can be used to create
|
2019-10-30 12:20:26 -07:00
|
|
|
resources into a virtual network. With the VPC you can define the region to use,
|
|
|
|
alongwith [Routes][gcp-rts], [Subnets][gcp-subnets], [Forwarding Rules][gcp-fwd-rules],
|
|
|
|
and [Firewall Rules][gcp-fw-rules].
|
2019-10-16 19:52:45 -07:00
|
|
|
|
|
|
|
The full code for this stack is on [GitHub][gh-repo-stack].
|
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
<!-- markdownlint-disable url -->
|
2019-10-30 12:20:26 -07:00
|
|
|
[gcp-managed-svcs]: https://cloud.google.com/products/
|
|
|
|
[gcp-subnets]: https://cloud.google.com/vpc/docs/vpc#vpc_networks_and_subnets
|
|
|
|
[gcp-fwd-rules]: https://cloud.google.com/compute/docs/protocol-forwarding
|
|
|
|
[gcp-vpc]: https://cloud.google.com/vpc/docs/overview
|
|
|
|
[gcp-rts]: https://cloud.google.com/vpc/docs/routes
|
|
|
|
[gcp-fw-rules]: https://cloud.google.com/vpc/docs/firewalls
|
2019-11-13 09:53:50 -08:00
|
|
|
[gh-repo-stack]: https://github.com/pulumi/kubernetes-guides/tree/master/gcp/02-managed-infra
|
2019-12-18 09:59:20 -08:00
|
|
|
<!-- markdownlint-enable url -->
|
2020-03-20 09:32:19 -07:00
|
|
|
|
|
|
|
{{% /choosable %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
|
|
|
## Overview
|
|
|
|
|
|
|
|
We'll configure and deploy:
|
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
* [Networking](#networking): To provide a virtual network for the cluster.
|
|
|
|
* [Storage](#storage): To provide data stores for the cluster.
|
2019-10-16 19:52:45 -07:00
|
|
|
|
|
|
|
## Networking
|
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% choosable cloud aws %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-16 13:05:14 -07:00
|
|
|
In [Crosswalk for AWS][crosswalk-aws] we showcase how to define networking:
|
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
* [VPCs][vpc]
|
|
|
|
* [Availability Zones][vpc-azs]
|
|
|
|
* [Subnets][vpc-subnets]
|
|
|
|
* [Internet & NAT Gateways][vpc-gw]
|
|
|
|
* [Security Groups][vpc-sg]
|
2019-10-16 13:05:14 -07:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
### Create a New VPC for Kubernetes
|
2019-10-16 13:05:14 -07:00
|
|
|
|
2019-11-12 10:30:40 -08:00
|
|
|
Create a new VPC to use with the cluster with custom settings and
|
2019-10-16 19:52:45 -07:00
|
|
|
best-practice defaults.
|
2019-10-16 13:05:14 -07:00
|
|
|
|
|
|
|
```typescript
|
|
|
|
import * as awsx from "@pulumi/awsx";
|
|
|
|
|
|
|
|
// Create a new VPC with custom settings.
|
|
|
|
const vpcName = "eksVpc";
|
|
|
|
const vpc = new awsx.ec2.Vpc(vpcName, {
|
|
|
|
cidrBlock: "172.16.0.0/16",
|
|
|
|
numberOfAvailabilityZones: "all",
|
|
|
|
tags: { "Name": vpcName },
|
|
|
|
});
|
|
|
|
|
|
|
|
// Export the VPC resource IDs.
|
|
|
|
export const vpcId = vpc.id;
|
|
|
|
export const publicSubnetIds = vpc.publicSubnetIds;
|
|
|
|
export const privateSubnetIds = vpc.privateSubnetIds;
|
|
|
|
```
|
2019-12-18 09:59:20 -08:00
|
|
|
|
2023-05-15 15:25:28 -07:00
|
|
|
[crosswalk-aws]: /docs/clouds/aws/guides/
|
|
|
|
[vpc]: /docs/clouds/aws/guides/vpc/#setting-up-a-new-vpc
|
|
|
|
[vpc-azs]: /docs/clouds/aws/guides/vpc/#configuring-availability-zones-for-an-aws-vpc
|
|
|
|
[vpc-subnets]: /docs/clouds/aws/guides/vpc/#configuring-subnets-for-a-vpc
|
|
|
|
[vpc-gw]: /docs/clouds/aws/guides/vpc/#configuring-internet-and-nat-gateways-for-subnets-in-a-vpc
|
|
|
|
[vpc-sg]: /docs/clouds/aws/guides/vpc/#configuring-security-groups-for-a-vpc
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
|
|
|
|
|
|
|
{{% choosable cloud azure %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
### Create a New Virtual Network for Kubernetes
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-11-12 10:30:40 -08:00
|
|
|
Create a new Virtual Network to use with the cluster with custom settings and
|
2019-10-16 19:52:45 -07:00
|
|
|
best-practice defaults.
|
|
|
|
|
|
|
|
```typescript
|
2019-10-28 21:10:01 -07:00
|
|
|
// Create a Virtual Network for the cluster.
|
|
|
|
const vnet = new azure.network.VirtualNetwork(name, {
|
|
|
|
resourceGroupName: config.resourceGroupName,
|
|
|
|
addressSpaces: ["10.2.0.0/16"],
|
|
|
|
});
|
|
|
|
|
|
|
|
// Create a Subnet for the cluster.
|
|
|
|
const subnet = new azure.network.Subnet(name, {
|
|
|
|
resourceGroupName: config.resourceGroupName,
|
|
|
|
virtualNetworkName: vnet.name,
|
|
|
|
addressPrefix: "10.2.1.0/24",
|
|
|
|
});
|
2019-10-16 19:52:45 -07:00
|
|
|
```
|
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% choosable cloud gcp %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
<!-- markdownlint-disable no-duplicate-heading -->
|
|
|
|
### Create a New VPC for Kubernetes
|
|
|
|
<!-- markdownlint-enable no-duplicate-heading -->
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-11-12 10:30:40 -08:00
|
|
|
Create a new network to use with the cluster with custom settings and
|
2019-10-16 19:52:45 -07:00
|
|
|
best-practice defaults.
|
|
|
|
|
|
|
|
```typescript
|
2019-10-30 12:20:26 -07:00
|
|
|
import * as gcp from "@pulumi/gcp";
|
|
|
|
|
|
|
|
const network = new gcp.compute.Network(name, {
|
|
|
|
project: config.project,
|
|
|
|
autoCreateSubnetworks: false,
|
|
|
|
});
|
|
|
|
export const networkName = network.name;
|
|
|
|
|
|
|
|
const subnet = new gcp.compute.Subnetwork(name, {
|
|
|
|
project: config.project,
|
|
|
|
region: pulumi.output(config.zone).apply(zone =>
|
|
|
|
(<string>zone)
|
|
|
|
.split("-")
|
|
|
|
.slice(0, 2)
|
|
|
|
.join("-"),
|
|
|
|
),
|
|
|
|
ipCidrRange: "10.0.0.0/24",
|
|
|
|
network: network.name,
|
|
|
|
secondaryIpRanges: [{ rangeName: "pods", ipCidrRange: "10.1.0.0/16" }],
|
|
|
|
});
|
|
|
|
export const subnetworkName = subnet.name;
|
2019-10-16 19:52:45 -07:00
|
|
|
```
|
2019-10-16 13:05:14 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
2019-10-16 13:05:14 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% choosable cloud aws %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-11-12 11:09:27 -08:00
|
|
|
#### Use the Default VPC with Kubernetes
|
2019-10-30 12:20:26 -07:00
|
|
|
|
2019-10-16 19:52:45 -07:00
|
|
|
Use the account's default VPC.
|
2019-10-16 13:05:14 -07:00
|
|
|
|
|
|
|
```typescript
|
|
|
|
import * as awsx from "@pulumi/awsx";
|
|
|
|
|
|
|
|
// Use the default VPC.
|
|
|
|
const defaultVpc = awsx.ec2.Vpc.getDefault();
|
|
|
|
|
|
|
|
// Export the VPC resource IDs.
|
|
|
|
export const defaultVpcId = defaultVpc.id;
|
|
|
|
export const defaultPublicSubnetIds = defaultVpc.publicSubnetIds;
|
|
|
|
export const defaultPrivateSubnetIds = defaultVpc.privateSubnetIds;
|
|
|
|
```
|
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
2019-10-16 13:05:14 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% choosable cloud aws %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-11-12 11:09:27 -08:00
|
|
|
#### Use an Existing VPC with Kubernetes
|
2019-10-16 19:52:45 -07:00
|
|
|
|
|
|
|
To use an existing VPC, provide the IDs of the VPC and its resources.
|
2019-10-16 13:05:14 -07:00
|
|
|
|
|
|
|
```typescript
|
|
|
|
import * as awsx from "@pulumi/awsx";
|
|
|
|
|
|
|
|
// Use an existing VPC, subnets, and gateways.
|
|
|
|
const existingVpc = awsx.ec2.Vpc.fromExistingIds("existingVpc", {
|
|
|
|
vpcId: "vpc-00000000000000000",
|
|
|
|
publicSubnetIds: ["subnet-00000000000000000", "subnet-11111111111111111"],
|
|
|
|
privateSubnetIds: ["subnet-22222222222222222", "subnet-33333333333333333"],
|
|
|
|
internetGatewayId: "igw-00000000000000000",
|
|
|
|
natGatewayIds: ["nat-00000000000000000", "nat-11111111111111111"],
|
|
|
|
})
|
|
|
|
|
|
|
|
// Export the VPC resource IDs.
|
|
|
|
export const existingVpcId = existingVpc.id;
|
|
|
|
export const existingPublicSubnetIds = existingVpc.publicSubnetIds;
|
|
|
|
export const existingPrivateSubnetIds = existingVpc.privateSubnetIds;
|
|
|
|
```
|
2019-12-18 09:59:20 -08:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
2019-10-16 13:05:14 -07:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
### Requirements & Recommendations
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% choosable cloud aws %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
|
|
|
See the official docs [EKS Network Requirements](https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html)
|
|
|
|
and [AWS VPC Recommendations](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Scenario2.html) for more details.
|
2019-10-16 13:05:14 -07:00
|
|
|
|
|
|
|
[eks-tagging]: https://docs.aws.amazon.com/eks/latest/userguide/network_reqs.html#vpc-subnet-tagging
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
|
|
|
|
|
|
|
{{% choosable cloud azure %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-28 21:10:01 -07:00
|
|
|
See the official Networking [docs][azure-net-docs] for more details.
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-28 21:10:01 -07:00
|
|
|
[azure-net-docs]: https://docs.microsoft.com/en-us/azure/aks/concepts-network
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% choosable cloud gcp %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-30 12:20:26 -07:00
|
|
|
See the official Networking [docs][gke-net-docs] for more details.
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-30 12:20:26 -07:00
|
|
|
[gke-net-docs]: https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-admin-overview
|
2020-03-20 09:32:19 -07:00
|
|
|
|
|
|
|
{{% /choosable %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
|
|
|
## Storage
|
|
|
|
|
2019-10-18 15:10:31 -07:00
|
|
|
Cloud storage persists data in many forms, from data warehouses to analytics,
|
|
|
|
and is presented as object, file, block storage, and migration capabilities.
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-18 15:10:31 -07:00
|
|
|
Generally, the storage services in this stack tend to be foundational for
|
|
|
|
teams, and is typically shared across clusters and orgs.
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-18 15:10:31 -07:00
|
|
|
In the managed clusters, the worker node groups by default will use block devices,
|
|
|
|
and Kubernetes itself could manage [PersistentVolumes][k8s-pvs].
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-18 15:10:31 -07:00
|
|
|
Often times, this layer may be conflated with storage services managed in stacks
|
|
|
|
closer to the apps, such as the Kubernetes [Cluster Services][crosswalk-cluster-svcs]
|
|
|
|
or [App Services][crosswalk-app-svcs]. Those higher layers tend to primarily focus on
|
|
|
|
the direct needs of a **given** Kubernetes cluster and its apps, rather than the
|
|
|
|
needs of your complete architecture.
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% choosable cloud aws %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
### Amazon Simple Storage Service (S3)
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-18 15:10:31 -07:00
|
|
|
See [Crosswalk AWS S3][pulumi-s3] and the [AWS S3 docs][aws-s3] for more details.
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
### Elastic Container Registry (ECR)
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-18 15:10:31 -07:00
|
|
|
See [Crosswalk AWS ECR][crosswalk-ecr] and the [AWS ECR docs][aws-ecr] for more details.
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
### Amazon Elastic File System (EFS)
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-10-18 15:10:31 -07:00
|
|
|
See [Persisting Kubernetes Workloads with Amazon EFS][pulumi-efs] and the
|
|
|
|
[AWS EFS docs][aws-efs] for more details.
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
<!-- markdownlint-disable url -->
|
2022-10-26 07:22:15 -07:00
|
|
|
[pulumi-efs]: /blog/persisting-kubernetes-workloads-with-amazon-efscsi-volumes-using-pulumi-sdks/
|
2019-10-18 15:10:31 -07:00
|
|
|
[aws-efs]: https://aws.amazon.com/efs/
|
2022-10-26 07:22:15 -07:00
|
|
|
[pulumi-s3]: /docs/aws/s3/
|
2023-05-15 15:25:28 -07:00
|
|
|
[crosswalk-ecr]: /docs/clouds/aws/guides/ecr/
|
2019-10-18 15:10:31 -07:00
|
|
|
[aws-ecr]: https://aws.amazon.com/ecr/
|
|
|
|
[aws-s3]: https://aws.amazon.com/s3
|
2019-12-18 09:59:20 -08:00
|
|
|
<!-- markdownlint-enable url -->
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
|
|
|
|
|
|
|
{{% choosable cloud azure %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
### Azure Blob Storage
|
2019-10-30 12:20:26 -07:00
|
|
|
|
|
|
|
Create a new blob storage with a data source of a local directory and files.
|
2019-10-16 19:52:45 -07:00
|
|
|
|
|
|
|
```typescript
|
2019-10-28 21:10:01 -07:00
|
|
|
import * as azure from "@pulumi/azure";
|
|
|
|
|
|
|
|
// Create an Azure Resource Group.
|
|
|
|
const resourceGroup = new azure.core.ResourceGroup("website-rg", {
|
|
|
|
location: azure.Locations.WestUS,
|
|
|
|
});
|
|
|
|
|
|
|
|
// Create a Storage Account.
|
|
|
|
const storageAccount = new azure.storage.Account("websitesa", {
|
|
|
|
resourceGroupName: resourceGroup.name,
|
|
|
|
accountReplicationType: "LRS",
|
|
|
|
accountTier: "Standard",
|
|
|
|
accountKind: "StorageV2",
|
|
|
|
});
|
|
|
|
|
|
|
|
// Upload the following files from a local directory.
|
|
|
|
["index.html", "404.html"].map(name =>
|
|
|
|
new azure.storage.Blob(name, {
|
|
|
|
name,
|
|
|
|
resourceGroupName: resourceGroup.name,
|
|
|
|
storageAccountName: storageAccount.name,
|
|
|
|
storageContainerName: "wwwroot",
|
|
|
|
type: "block",
|
|
|
|
source: `./wwwroot/${name}`,
|
|
|
|
contentType: "text/html",
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
```
|
2019-11-12 11:09:27 -08:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
### Azure Container Registry (ACR)
|
2019-10-28 21:10:01 -07:00
|
|
|
|
2019-11-08 23:36:48 -08:00
|
|
|
Create a new registry, build a local Docker image, and push it to the registry.
|
2019-10-30 12:20:26 -07:00
|
|
|
|
2019-10-28 21:10:01 -07:00
|
|
|
```typescript
|
|
|
|
import * as azure from "@pulumi/azure";
|
|
|
|
|
|
|
|
// Create an Azure Resource Group.
|
|
|
|
const resourceGroup = new azure.core.ResourceGroup("rg", {
|
|
|
|
location: "West US",
|
|
|
|
name: "resourceGroup1",
|
|
|
|
});
|
|
|
|
|
|
|
|
// Create an ACR.
|
2019-11-08 23:36:48 -08:00
|
|
|
const registry = new azure.containerservice.Registry("acr", {
|
2019-10-28 21:10:01 -07:00
|
|
|
adminEnabled: false,
|
|
|
|
georeplicationLocations: [
|
|
|
|
"East US",
|
|
|
|
"West Europe",
|
|
|
|
],
|
|
|
|
location: resourceGroup.location,
|
|
|
|
name: "containerRegistry1",
|
|
|
|
resourceGroupName: resourceGroup.name,
|
|
|
|
sku: "Premium",
|
|
|
|
});
|
2019-11-08 23:36:48 -08:00
|
|
|
|
|
|
|
// Build a local Docker image with a given Dockerfile context, and push it
|
|
|
|
// to the registry.
|
|
|
|
const customImage = "node-app";
|
|
|
|
const appImage = new docker.Image(customImage, {
|
|
|
|
imageName: pulumi.interpolate`${registry.loginServer}/${customImage}:v1.0.0`,
|
|
|
|
build: {
|
|
|
|
context: `./${customImage}`,
|
|
|
|
},
|
|
|
|
registry: {
|
|
|
|
server: registry.loginServer,
|
|
|
|
username: registry.adminUsername,
|
|
|
|
password: registry.adminPassword,
|
|
|
|
},
|
|
|
|
});
|
2019-10-16 19:52:45 -07:00
|
|
|
```
|
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% choosable cloud gcp %}}
|
2019-10-16 19:52:45 -07:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
### Google Container Registry (GCR)
|
2019-10-30 12:20:26 -07:00
|
|
|
|
|
|
|
Fetch the URL to use for the Debian container image.
|
2019-10-16 19:52:45 -07:00
|
|
|
|
|
|
|
```typescript
|
2019-10-30 12:20:26 -07:00
|
|
|
import * as gcp from "@pulumi/gcp";
|
|
|
|
|
|
|
|
const debian = gcp.container.getRegistryImage({
|
|
|
|
name: "debian",
|
|
|
|
});
|
|
|
|
|
|
|
|
export const gcrLocation = debian.imageUrl;
|
|
|
|
```
|
|
|
|
|
2019-11-08 23:36:48 -08:00
|
|
|
Fetch the project's registry and display its GCR location.
|
|
|
|
|
|
|
|
```ts
|
|
|
|
import * as gcp from "@pulumi/gcp";
|
|
|
|
|
|
|
|
const registry = gcp.container.getRegistryRepository();
|
|
|
|
export const gcrLocation = registry.repositoryUrl;
|
|
|
|
```
|
|
|
|
|
|
|
|
Build a local Docker image with a given Dockerfile context, and push it to the registry.
|
2019-12-18 09:59:20 -08:00
|
|
|
|
2019-11-08 23:36:48 -08:00
|
|
|
```ts
|
|
|
|
import * as docker from "@pulumi/docker";
|
|
|
|
|
|
|
|
const customImage = "node-app";
|
|
|
|
const appImage = new docker.Image(customImage, {
|
|
|
|
imageName: pulumi.interpolate`${registry.repositoryUrl}/${customImage}:v1.0.0`,
|
|
|
|
build: {
|
|
|
|
context: `./${customImage}`,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2023-05-15 15:25:28 -07:00
|
|
|
### Google Cloud Object Storage
|
2019-10-30 12:20:26 -07:00
|
|
|
|
|
|
|
Create a new bucket with a data source of a local file.
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
import * as gcp from "@pulumi/gcp";
|
|
|
|
|
|
|
|
const picture = new gcp.storage.BucketObject("picture", {
|
|
|
|
bucket: "image-store",
|
|
|
|
source: new pulumi.asset.FileAsset("/images/nature/garden-tiger-moth.jpg"),
|
|
|
|
});
|
2019-10-16 19:52:45 -07:00
|
|
|
```
|
|
|
|
|
2020-03-20 09:32:19 -07:00
|
|
|
{{% /choosable %}}
|
2019-10-18 15:10:31 -07:00
|
|
|
|
2019-12-18 09:59:20 -08:00
|
|
|
<!-- markdownlint-disable url -->
|
2023-05-15 15:25:28 -07:00
|
|
|
[crosswalk-cluster-svcs]: /docs/clouds/kubernetes/guides/cluster-services/
|
|
|
|
[crosswalk-app-svcs]: /docs/clouds/kubernetes/guides/app-services/
|
2019-10-18 15:10:31 -07:00
|
|
|
[k8s-pvs]: https://kubernetes.io/docs/concepts/storage/persistent-volumes/
|
2019-12-18 09:59:20 -08:00
|
|
|
<!-- markdownlint-enable url -->
|