找回密码
 注册
查看: 3895|回复: 0

Configuring for AWS

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2018-12-20 01:44:01 | 显示全部楼层 |阅读模式
Configuring for AWS2 v* O" }% n. `
Overview! i4 m. Y+ {& U
Configuring AWS Variables
% b* @$ }) X  qConfiguring OpenShift Container Platform Masters for AWS
( J0 P5 L% A+ tConfiguring OpenShift Container Platform for AWS with Ansible. M) A) |: I0 j. h7 b# i7 V
Manually Configuring OpenShift Container Platform Masters for AWS$ E$ E, Z8 Q9 W/ g8 V
Manually Configuring OpenShift Container Platform Nodes for AWS
) k6 d9 H  U" B9 KSetting Key Value Access Pairs
) n5 V( |- U2 ZApplying Configuration Changes- f( [  x  g4 s  j* y" b
Overview
8 ^/ L0 \. o; {% bOpenShift Container Platform 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 OpenShift Container Platform hosts.
" O2 E" p9 Q% n& a$ M
8 k( ~) ]/ J' y' l- l; jConfiguring AWS Variables1 J( i" S6 y  x3 O5 l! a7 R2 K
To set the required AWS variables, create a /etc/aws/aws.conf file with the following contents on all of your OpenShift Container Platform hosts, both masters and nodes:
: R$ o5 q3 {& ^* a. }9 L6 J( C7 \( K  l4 ]! O1 D
[Global]
! X3 q! y- \. ]8 z' |Zone = us-east-1c & |) h* ^4 s& Z. C
This is the Availability Zone of your AWS Instance and where your EBS Volume resides; this information is obtained from the AWS Managment Console.$ @# ~! y# k( h+ F' d% n2 C5 j; X
Configuring OpenShift Container Platform Masters for AWS
% w1 ?  c' r" s  B! SYou can set the AWS configuration on your OpenShift Container Platform master hosts in two ways:% ^1 \4 o: Q( Y* R

+ \( e2 k7 Z0 U" C5 uusing Ansible and the advanced installation tool
' n: t; C& t2 Z
3 B( t- |( r$ `% {. P) \0 A& z  Kmanually, by modifying the master-config.yaml file4 X$ A! C2 N  h4 S

( u  u7 }% |4 I. W6 I0 @5 ?8 `5 HConfiguring OpenShift Container Platform for AWS with Ansible
3 g9 s1 ?7 B# y- ^9 bDuring advanced installations, AWS can be configured using the openshift_cloudprovider_aws_access_key, openshift_cloudprovider_aws_secret_key, and openshift_cloudprovider_kind parameters, which are configurable in the inventory file.
0 g# b+ y* ~5 n% e4 q
$ e1 O' V9 ]5 P) @" ]Example 1. Example AWS Configuration with Ansible
1 K! m  Q* V$ G! N6 s# Cloud Provider Configuration; F# \+ ]) ~1 Y9 H
#  d# r1 X' P" a- E8 X/ ?6 @  h2 F
# Note: You may make use of environment variables rather than store
& u0 O. q& v( |& [2 q, P' ]$ r# sensitive configuration within the ansible inventory.+ Q3 |0 k1 V! @$ U
# For example:; q  _8 L! h2 o/ g& f" ?+ a
#openshift_cloudprovider_aws_access_key="{{ lookup('env','AWS_ACCESS_KEY_ID') }}"; b- z0 q/ ^2 X; Q; Y5 {5 @+ x
#openshift_cloudprovider_aws_secret_key="{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}"# c8 p% Z, |0 c( C$ e; K- ^
#
; B) c- c0 Q$ r& O, v" R# AWS
5 D# F7 i; u  u# E$ n( f8 @( b1 e#openshift_cloudprovider_kind=aws
* m8 u! ?- p9 P4 W) P8 T5 s# Note: IAM profiles may be used instead of storing API credentials on disk./ O, z/ j/ J8 R1 Z* U8 |( j; K7 l
#openshift_cloudprovider_aws_access_key=aws_access_key_id
$ [4 m% g! D, E6 ~% k#openshift_cloudprovider_aws_secret_key=aws_secret_access_key
( i5 A+ I- H$ c4 e( }+ h) eWhen Ansible configures AWS, the following files are created for you:3 ~1 s: G7 J! b

7 P! d! e9 M( g, W9 W/etc/aws/aws.conf/ C: w+ ]4 Z/ y% s! _: @2 n

. q0 f2 f& n7 u8 X0 \2 v9 @$ |/etc/origin/master/master-config.yaml
0 f5 `$ V2 U4 {3 C' k6 c+ R3 J/ B# _2 K; [. [/ ~5 U
/etc/origin/node/node-config.yaml6 v+ W4 w, [# n
: U+ c* _" s. x  ], J% }
/etc/sysconfig/atomic-openshift-master% B4 g/ m1 x6 z" V! V
7 R6 Z# Z$ `+ M3 Q. l$ {& r5 _
/etc/sysconfig/atomic-openshift-node8 ^) G- d% F- F. E% b0 H% C
/ J' b! D2 C# b; b" z
Manually Configuring OpenShift Container Platform Masters for AWS
) I! N# P9 G+ d& K4 nEdit 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:
; r/ O& j' G2 P4 {" }2 C3 \, a( ^/ Y* b% ?$ A8 k" }6 L9 v
kubernetesMasterConfig:4 h- s" j0 s( F( v: H
  ...
! D% @9 T# t3 g3 ~: B  apiServerArguments:
+ O- P# A4 k6 ^; _    cloud-provider:
! {5 x* P2 d9 G) q: g# L      - "aws"
" ?$ a- h& R0 l    cloud-config:
2 |8 A$ p% L, X" n+ C  [      - "/etc/aws/aws.conf"5 j9 P  ]3 R  P  g( O  Y
  controllerArguments:
. q4 S3 h- |& L3 O3 q8 m  w& M    cloud-provider:
7 A- W8 t( u) _* h: @) W8 g% n# r      - "aws"* e' _0 y0 f7 }# Z5 ^3 i- I
    cloud-config:
/ x+ T: O& q/ z0 _      - "/etc/aws/aws.conf"
" q2 ^. i# ]" C" B! G% LCurrently, the nodeName must match the instance name in AWS in order for the cloud provider integration to work properly. The name must also be RFC1123 compliant.
  W3 b+ Z9 L7 z4 v# D: p
# A2 J! D7 i$ |4 a; q8 [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/.
2 g, x. n7 k' D+ ]  VManually Configuring OpenShift Container Platform Nodes for AWS+ A$ p* A' I6 U$ @# A
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:: w/ {% K3 \3 n: m

0 R* x, g- o& P) e( h  ~kubeletArguments:" j- Z" w: u) d+ G
  cloud-provider:
# N5 S' F  D! f. o1 A% E* E    - "aws"
: X" A4 t, v7 |% w# a  cloud-config:+ d) w4 ?# [1 t7 _+ J3 B! M$ T
    - "/etc/aws/aws.conf"
: J% P0 v. x! n# I/ |. U& WWhen 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/.
/ B$ M% e! l" z- hSetting Key Value Access Pairs
! @' C+ J0 |5 w' JMake sure the following environment variables are set in the /etc/sysconfig/atomic-openshift-master file on masters and the /etc/sysconfig/atomic-openshift-node file on nodes:
! R" V8 t4 F( r3 w" o! x5 c0 ?/ z9 Y. |) `0 J; f
AWS_ACCESS_KEY_ID=<key_ID>: ?# _  M; S; u! t, W( A! V
AWS_SECRET_ACCESS_KEY=<secret_key>" c" `1 ^0 r3 ^! u0 _0 ^7 z
Access keys are obtained when setting up your AWS IAM user.7 o/ h- Q! c6 x7 K2 b; K
Applying Configuration Changes/ O& w" w3 e8 C; P6 s9 e- y
Start or restart OpenShift Container Platform services on all master and node hosts to apply your configuration changes:. |$ i7 @' B; V: v% G9 @) [# {
$ V6 g7 z; t6 i/ W, A) t
$ systemctl restart atomic-openshift-master
/ U: O# w) w) H1 S. q$ systemctl restart atomic-openshift-node
1 V5 k/ _4 x! ^9 q8 FSwitching 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:5 O3 I: @8 q6 i. n' H# ?) }

# q" X' e* W4 _8 b9 TLog in to the CLI as a cluster administrator.1 w  o& v6 t2 M7 a+ L# X- p- `2 [. _

+ M  T2 l9 ?2 f9 ?& V( BCheck and backup existing node labels:
) D9 s7 e3 G3 w; E- \1 u
; n( i* y; E1 \- B$ X) N$ oc describe node <node_name> | grep -Poz '(?s)Labels.*\n.*(?=Taints)'
$ M* V! V7 R4 ~3 @Delete the nodes:
& b7 N  p9 g; m) t' ^$ V5 j: ~/ \3 H' Y9 H
$ oc delete node <node_name>' T3 p- _/ `" u1 _, h# `
On each node host, restart the OpenShift Container Platform service., k& ?* F9 z2 }7 f  D

% ]: ^0 C2 R; X- q/ u$ systemctl restart atomic-openshift-node
8 J9 m" p7 U8 v( u; n6 P& `  [Add back any labels on each node that you previously had
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:01 , Processed in 0.016434 second(s), 21 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表