aws

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

README

AWS Fargate

AWS Fargate is a technology that allows you to run containers without having to manage servers or clusters. With AWS Fargate, you no longer have to provision, configure and scale clusters of virtual machines to run containers. This removes the need to choose server types, decide when to scale your clusters, or optimize cluster packing. Fargate lets you focus on designing and building your applications instead of managing the infrastructure that runs them.

Fargate makes it easy to scale your applications. You no longer have to worry about provisioning enough compute resources. You can launch tens or tens of thousands of containers in seconds.

With Fargate, billing is at a per second granularity and you only pay for what you use. You pay for the amount of vCPU and memory resources your containerized application requests. vCPU and memory resources are calculated from the time your container images are pulled until they terminate, rounded up to the nearest second.

AWS Fargate virtual-kubelet provider

Virtual-kubelet and the AWS Fargate virtual-kubelet provider are in very early stages of development.
DO NOT run them in any Kubernetes production environment or connect to any Fargate production cluster.

AWS Fargate virtual-kubelet provider connects your Kubernetes cluster to a Fargate cluster in AWS. The Fargate cluster is exposed as a virtual node with the CPU and memory capacity that you choose. Pods scheduled on the virtual node run on Fargate like they would run on a standard Kubernetes node.

See our AWS Open Source Blog post for detailed step-by-step instructions on how to run virtual-kubelet with AWS Fargate. If you are already familiar with virtual-kubelet, the rest of this README contains an overview of how to setup AWS Fargate.

Prerequisites

If you have never used Fargate before, the easiest way to get started is to run Fargate's First run experience. This will setup Fargate in your AWS account with the default settings. It will create a default Fargate cluster, IAM roles, a default VPC with an internet gateway and a default security group. You can always fine-tune individual settings later.

Once you have your first application on Fargate running, move on to the next section below.

You may also want to install the AWS CLI and visit the AWS ECS console to take a closer look at your Fargate resources.

Configuration

In order to run virtual-kubelet for AWS Fargate, you need a simple configuration file. We have provided a sample configuration file for you that contains reasonable defaults and brief descriptions for each field.

Create a copy of the sample configuration file and customize it.

If you ran the first-run experience, you only need to provide a subnet and set AssignPublicIPv4Address to true. You can leave the security groups list blank to use the default security group. You can learn your subnet ID in AWS console VPC subnets page. You also need to update your security group to allow traffic to your pods.

Authentication via IAM

Virtual-kubelet needs permission to schedule pods on Fargate on your behalf. The easiest way to do so is to run virtual-kubelet on a worker node in your Kubernetes cluster in EC2. Attach an IAM role to the worker node EC2 instance and give it permission to your Fargate cluster.

Connecting virtual-kubelet to your Kubernetes cluster

Copy the virtual-kubelet binary and your configuration file to your Kubernetes worker node in EC2.

virtual-kubelet --provider aws --provider-config fargate.toml

In your Kubernetes cluster, confirm that the virtual-kubelet shows up as a node.

kubectl get nodes

NAME                            STATUS    ROLES     AGE       VERSION
virtual-kubelet                 Ready     agent     5s        v1.8.3

To disconnect, stop the virtual-kubelet process.

Deploying Kubernetes pods in AWS Fargate

Virtual-kubelet currently supports only a subset of regular kubelet functionality. In order to not break existing pod deployments, pods that are to be deployed on Fargate require an explicit node selector that points to the virtual node.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FargateProvider

type FargateProvider struct {
	// contains filtered or unexported fields
}

FargateProvider implements the virtual-kubelet provider interface.

func NewFargateProvider

func NewFargateProvider(
	config string,
	rm *manager.ResourceManager,
	nodeName string,
	operatingSystem string,
	internalIP string,
	daemonEndpointPort int32) (*FargateProvider, error)

NewFargateProvider creates a new Fargate provider.

func (*FargateProvider) Capacity

Capacity returns a resource list with the capacity constraints of the provider.

func (*FargateProvider) CreatePod

func (p *FargateProvider) CreatePod(ctx context.Context, pod *corev1.Pod) error

CreatePod takes a Kubernetes Pod and deploys it within the Fargate provider.

func (*FargateProvider) DeletePod

func (p *FargateProvider) DeletePod(ctx context.Context, pod *corev1.Pod) error

DeletePod takes a Kubernetes Pod and deletes it from the provider.

func (*FargateProvider) GetContainerLogs

func (p *FargateProvider) GetContainerLogs(ctx context.Context, namespace, podName, containerName string, opts api.ContainerLogOpts) (io.ReadCloser, error)

GetContainerLogs retrieves the logs of a container by name from the provider.

func (*FargateProvider) GetPod

func (p *FargateProvider) GetPod(ctx context.Context, namespace, name string) (*corev1.Pod, error)

GetPod retrieves a pod by name from the provider (can be cached).

func (*FargateProvider) GetPodFullName added in v0.4.1

func (p *FargateProvider) GetPodFullName(namespace string, pod string) string

GetPodFullName retrieves the full pod name as defined in the provider context.

func (*FargateProvider) GetPodStatus

func (p *FargateProvider) GetPodStatus(ctx context.Context, namespace, name string) (*corev1.PodStatus, error)

GetPodStatus retrieves the status of a pod by name from the provider.

func (*FargateProvider) GetPods

func (p *FargateProvider) GetPods(ctx context.Context) ([]*corev1.Pod, error)

GetPods retrieves a list of all pods running on the provider (can be cached).

func (*FargateProvider) NodeAddresses

func (p *FargateProvider) NodeAddresses(ctx context.Context) []corev1.NodeAddress

NodeAddresses returns a list of addresses for the node status within Kubernetes.

func (*FargateProvider) NodeConditions

func (p *FargateProvider) NodeConditions(ctx context.Context) []corev1.NodeCondition

NodeConditions returns a list of conditions (Ready, OutOfDisk, etc), which is polled periodically to update the node status within Kubernetes.

func (*FargateProvider) NodeDaemonEndpoints

func (p *FargateProvider) NodeDaemonEndpoints(ctx context.Context) *corev1.NodeDaemonEndpoints

NodeDaemonEndpoints returns NodeDaemonEndpoints for the node status within Kubernetes.

func (*FargateProvider) OperatingSystem

func (p *FargateProvider) OperatingSystem() string

OperatingSystem returns the operating system the provider is for.

func (*FargateProvider) RunInContainer added in v0.10.0

func (p *FargateProvider) RunInContainer(ctx context.Context, namespace, podName, containerName string, cmd []string, attach api.AttachIO) error

RunInContainer executes a command in a container in the pod, copying data between in/out/err and the container's stdin/stdout/stderr.

func (*FargateProvider) UpdatePod

func (p *FargateProvider) UpdatePod(ctx context.Context, pod *corev1.Pod) error

UpdatePod takes a Kubernetes Pod and updates it within the provider.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL