- 积分
- 16844
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
Configuring for AWS1 R; L3 F! j6 I1 D1 i( e
Overview6 \1 L. b/ d5 t0 G! X# W# O6 |5 |+ v
Configuring AWS Variables
$ V/ L/ Z2 c0 K& u/ aConfiguring OpenShift Container Platform Masters for AWS9 L9 `3 g7 U, ~8 L- U1 g0 M8 Z
Configuring OpenShift Container Platform for AWS with Ansible4 b: z% \1 p5 ~& A4 `& X
Manually Configuring OpenShift Container Platform Masters for AWS
# w2 u9 m9 Y! W8 y- x EManually Configuring OpenShift Container Platform Nodes for AWS% I$ l4 N- D( b9 G) t/ A
Setting Key Value Access Pairs1 T, G# ~: m* t& p
Applying Configuration Changes0 b& _1 Q# h: Z
Overview+ p6 z$ a$ v g8 q
OpenShift 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.
$ A, E7 r' r& O5 l% y, f
- U1 M4 u) g6 v- OConfiguring AWS Variables
# @" `& k+ l- Y( N. ITo 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:1 p0 Z! m& p1 u1 X& L! P- f [0 n
* `# K3 R4 v" s: }
[Global]
) _2 R9 `! p. A. yZone = us-east-1c
x/ y0 @5 F7 ^1 AThis is the Availability Zone of your AWS Instance and where your EBS Volume resides; this information is obtained from the AWS Managment Console.
1 H: Y5 }5 w% g* W1 T) N* f6 {2 ?4 g, TConfiguring OpenShift Container Platform Masters for AWS1 j8 W2 Z5 {9 c+ j, E, S- G
You can set the AWS configuration on your OpenShift Container Platform master hosts in two ways:0 Y* k8 k R1 x( j, X, x# a/ y
' Y) w/ r4 ~- L9 O5 A! J# A6 T5 Uusing Ansible and the advanced installation tool6 G H% Z+ r4 X1 M/ ~# ^# [
5 Y1 s g. f- k% @
manually, by modifying the master-config.yaml file" Q8 r8 w0 }! F% F
; C3 Q: S/ L6 Q) ]1 x7 z: mConfiguring OpenShift Container Platform for AWS with Ansible
: | v$ V# c" G. K J) @, uDuring 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.
9 w: i' N. o5 }& F' j- a6 `( o0 }3 J3 d
Example 1. Example AWS Configuration with Ansible
) F+ m- Q$ a# ]# Cloud Provider Configuration9 q( g/ ^. p" u: m
#+ K; d) ]! y" W. X8 g
# Note: You may make use of environment variables rather than store, r) g! N; G9 b% F# h6 P! E
# sensitive configuration within the ansible inventory.
6 v* p$ k: M" a7 M# For example:- D5 x8 N" l3 z
#openshift_cloudprovider_aws_access_key="{{ lookup('env','AWS_ACCESS_KEY_ID') }}"9 n+ c8 [3 c: M3 f& `9 s8 A
#openshift_cloudprovider_aws_secret_key="{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}"8 N% s& [ O* p ^2 e, ]
#( X! h X) x: M1 F/ P( B
# AWS
6 e! s% P& |2 F! q! z+ M#openshift_cloudprovider_kind=aws- n2 I6 _# W2 f7 I
# Note: IAM profiles may be used instead of storing API credentials on disk.
0 s* o3 K$ J. b' L#openshift_cloudprovider_aws_access_key=aws_access_key_id3 q; X! C/ m2 G0 p) j7 a
#openshift_cloudprovider_aws_secret_key=aws_secret_access_key
; n+ Z* @( c$ F6 xWhen Ansible configures AWS, the following files are created for you:/ l& ]& s$ v! j& _( h9 M9 ^; u
4 Z- }( ?' o1 H' K
/etc/aws/aws.conf" K1 i; ^$ `5 G4 p& i
! D- {) Z) e& ~5 {: ]/etc/origin/master/master-config.yaml
$ A/ I! U2 L" Z" B2 P: T9 [$ `4 Q" b/ h* t3 g+ F
/etc/origin/node/node-config.yaml% O8 j, W: h$ W0 _" m7 X, C
0 @1 M- O% @; l8 [/etc/sysconfig/atomic-openshift-master
9 _) Y2 n0 ?9 v9 H$ r& |6 H ]
M0 ?. l% }; V/etc/sysconfig/atomic-openshift-node% @; j# z1 ~( |) K6 m2 [' U/ w
2 t0 A( _" m. t# G6 ? }+ z/ O
Manually Configuring OpenShift Container Platform Masters for AWS
6 G" T" v* ]* F4 OEdit 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:# l# Q/ v% }% t7 U4 q! |& S
" S$ j9 h! r# ^% ?kubernetesMasterConfig:
& A" c# D2 h2 @$ x, g+ e* C ...5 U0 d- L$ b" u. x3 `* c+ v9 A
apiServerArguments: o& C4 {8 |7 {1 D1 Z; n/ |3 S
cloud-provider:3 P9 B( D8 J2 C( |7 S
- "aws"
( z4 z7 h2 y' a8 } cloud-config:" B( _0 L/ `! U' E
- "/etc/aws/aws.conf"
4 I& U2 [" S3 o3 j1 _ controllerArguments:
8 I* x" i" t5 U3 ^ cloud-provider:
" P [( ]4 q d$ A; t6 I: e - "aws": W0 K T8 w8 w8 m. a( m
cloud-config:
# f/ d1 Z9 W/ R3 G - "/etc/aws/aws.conf"
0 z- p' O# G# P' w$ WCurrently, 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.% Z* f: E0 Y; O( [; Z* T
* o3 n$ b. C* z7 v
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/.+ ~! H& f* x+ k* N$ o
Manually Configuring OpenShift Container Platform Nodes for AWS
; Q" z0 N$ x5 \) q. D5 c( nEdit 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:
! ?9 q% `$ t" ]
" b' Q- | H8 |3 N! Y: ~3 A: tkubeletArguments:
" r7 \2 N( D0 V! R1 h* Y; ?& G cloud-provider:: k8 q% j2 D" u1 ^) Y# S) n
- "aws", l, s% `$ D2 r5 e3 |# O3 f3 s7 _
cloud-config:
. W5 _, \+ [6 n( a) ], I - "/etc/aws/aws.conf"
8 Y5 `0 w. ~+ `: z9 P0 rWhen 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/.
4 H* _. i5 f9 ^1 LSetting Key Value Access Pairs. l q S; \ J- _
Make 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:' u2 m- p3 \; N) n/ W
0 t: z; _' a$ S# j
AWS_ACCESS_KEY_ID=<key_ID>8 C9 E8 ~: U S4 M9 {9 u, ^% k O
AWS_SECRET_ACCESS_KEY=<secret_key>, |- V; U% {0 f- _
Access keys are obtained when setting up your AWS IAM user.
+ W) Y% T2 K* m: VApplying Configuration Changes
8 P8 R. N; M8 i; o! j, jStart or restart OpenShift Container Platform services on all master and node hosts to apply your configuration changes:
* W C, M: l; g7 @) }& e' y& D+ F* k" e! v7 w
$ systemctl restart atomic-openshift-master
' p2 H1 J6 W( D% e4 W$ systemctl restart atomic-openshift-node
; f& H- x! f" u1 Y/ t, R# A( uSwitching 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:
6 W# w c9 m+ m3 V8 _+ [4 y2 A' c% }8 ~2 J, J4 T
Log in to the CLI as a cluster administrator.- J7 s! y( }. ^9 H# y- k
& N w2 P' P) l9 E! m5 H2 s; tCheck and backup existing node labels:0 z5 H, Z6 Y* K
6 U* y2 e3 `% e( I( t; g$ oc describe node <node_name> | grep -Poz '(?s)Labels.*\n.*(?=Taints)'% K1 F; C/ K% u
Delete the nodes:
" {3 \9 |% t8 h* [& U- s% O' b3 [! P6 b; E3 O; q" k1 j9 y
$ oc delete node <node_name>- @( c: z) H3 u3 z5 C! ?
On each node host, restart the OpenShift Container Platform service.; F' A9 \' `1 [4 {# j
" w. i" W+ l# E9 ]8 V7 Y
$ systemctl restart atomic-openshift-node
. w- I2 U9 n4 y, XAdd back any labels on each node that you previously had |
|