Skip to content

Latest commit

 

History

History
202 lines (172 loc) · 6.09 KB

configuring_aws.adoc

File metadata and controls

202 lines (172 loc) · 6.09 KB

Configuring for AWS

Overview

{product-title} can be configured to access an AWS EC2 infrastructure, including using AWS volumes as persistent storage for application data. After AWS is configured properly, some additional configurations will need to be completed on the {product-title} hosts.

Configuring AWS Variables

To set the required AWS variables, create a /etc/aws/aws.conf file with the following contents on all of your {product-title} hosts, both masters and nodes:

[Global]
Zone = us-east-1c (1)
  1. This is the Availability Zone of your AWS Instance and where your EBS Volume resides; this information is obtained from the AWS Managment Console.

Configuring {product-title} Masters for AWS

You can set the AWS configuration on your {product-title} master hosts in two ways:

Configuring {product-title} for AWS with Ansible

Example 1. Example AWS Configuration with Ansible
# Cloud Provider Configuration
#
# Note: You may make use of environment variables rather than store
# sensitive configuration within the ansible inventory.
# For example:
#openshift_cloudprovider_aws_access_key="{{ lookup('env','AWS_ACCESS_KEY_ID') }}"
#openshift_cloudprovider_aws_secret_key="{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}"
#
# AWS
#openshift_cloudprovider_kind=aws
# Note: IAM profiles may be used instead of storing API credentials on disk.
#openshift_cloudprovider_aws_access_key=aws_access_key_id
#openshift_cloudprovider_aws_secret_key=aws_secret_access_key
Note

When Ansible configures AWS, the following files are created for you:

  • /etc/aws/aws.conf

  • /etc/origin/master/master-config.yaml

  • /etc/origin/node/node-config.yaml

  • /etc/sysconfig/atomic-openshift-master

  • /etc/sysconfig/atomic-openshift-node

Manually Configuring {product-title} Masters for AWS

Edit or create the master configuration file on all masters (/etc/origin/master/master-config.yaml by default) and update the contents of the apiServerArguments and controllerArguments sections:

kubernetesMasterConfig:
  ...
  apiServerArguments:
    cloud-provider:
      - "aws"
    cloud-config:
      - "/etc/aws/aws.conf"
  controllerArguments:
    cloud-provider:
      - "aws"
    cloud-config:
      - "/etc/aws/aws.conf"
Important

When triggering a containerized installation, only the directories of /etc/origin and /var/lib/origin are mounted to the master and node container. Therefore, aws.conf should be in /etc/origin/ instead of /etc/.

Manually Configuring {product-title} Nodes for AWS

Edit or create the node configuration file on all nodes (/etc/origin/node/node-config.yaml by default) and update the contents of the kubeletArguments section:

kubeletArguments:
  cloud-provider:
    - "aws"
  cloud-config:
    - "/etc/aws/aws.conf"
Important

When triggering a containerized installation, only the directories of /etc/origin and /var/lib/origin are mounted to the master and node container. Therefore, aws.conf should be in /etc/origin/ instead of /etc/.

Setting Key Value Access Pairs

Make sure the following environment variables are set in the

AWS_ACCESS_KEY_ID=<key_ID>
AWS_SECRET_ACCESS_KEY=<secret_key>
Note

Access keys are obtained when setting up your AWS IAM user.

Applying Configuration Changes

Start or restart {product-title} services on all master and node hosts to apply your configuration changes:

Switching from not using a cloud provider to using a cloud provider produces an error message. Adding the cloud provider tries to delete the node because the node switches from using the hostname as the externalID (which would have been the case when no cloud provider was being used) to using the AWS instance-id (which is what the AWS cloud provider specifies). To resolve this issue:

  1. Log in to the CLI as a cluster administrator.

  2. Delete the nodes:

    $ oc delete node <node_name>
  3. On each node host, restart the atomic-openshift-node service.

  4. Add back any labels on each node that you previously had.