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

Configuring for AWS

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2018-12-20 01:44:01 | 显示全部楼层 |阅读模式
Configuring for AWS
% J, }' Z2 R/ _2 @1 [! Y: YOverview0 R5 I' S2 \# i* q8 t6 s
Configuring AWS Variables! q  j# O* V0 D) l* a
Configuring OpenShift Container Platform Masters for AWS
  x  x1 u5 X/ v4 B3 UConfiguring OpenShift Container Platform for AWS with Ansible
" X: W7 H! G' a- v+ Y' cManually Configuring OpenShift Container Platform Masters for AWS
* o+ G1 a+ m" p; N$ d& UManually Configuring OpenShift Container Platform Nodes for AWS
) l2 c+ c6 J4 B4 BSetting Key Value Access Pairs
$ e, S  O6 v- V- p( S) O- CApplying Configuration Changes. b9 K% H* ^1 a. ]" x/ s7 [
Overview
* C. x1 f8 W! ^1 ROpenShift 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.3 ~% f4 u+ x( B2 u

( C8 a3 J7 b7 J: pConfiguring AWS Variables. G6 }* T+ c5 R2 e
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:- j' H5 M/ N5 t/ a& r3 x

7 Q0 U, @0 g! K5 _  @[Global]
- _; O: M$ f/ q1 k4 CZone = us-east-1c
) C# l) T' N! L; X/ ^) MThis is the Availability Zone of your AWS Instance and where your EBS Volume resides; this information is obtained from the AWS Managment Console.6 c, m) }$ z# ]" v: V
Configuring OpenShift Container Platform Masters for AWS
. }$ c' M" e% }( kYou can set the AWS configuration on your OpenShift Container Platform master hosts in two ways:
  g6 i' b8 `0 Z$ h6 h6 V
' r! ~/ ~: B' fusing Ansible and the advanced installation tool% ~/ I: f% w& z* d3 r0 v
6 R' L4 `: z! o& t. W/ N0 |
manually, by modifying the master-config.yaml file
: J6 r- y8 C, l* p: a
8 A9 {: l9 y5 m+ U4 RConfiguring OpenShift Container Platform for AWS with Ansible8 f2 O  U3 g. D% @
During 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.
' n5 H/ e$ ^# A% F  g& Y- G' Z. @- y; P! t, v) B" @9 n5 M) L, ~) H/ }9 h
Example 1. Example AWS Configuration with Ansible
; J4 d* F- H3 [# Cloud Provider Configuration
" E% V0 x6 E) b5 z3 i& N#+ r, `- D/ L6 w9 Q) T
# Note: You may make use of environment variables rather than store
* z4 o& h  M+ e$ A' U. d# sensitive configuration within the ansible inventory.
. R+ ]/ ], _. z1 H3 ], L' `+ O# For example:5 \7 `; z! p) w$ v
#openshift_cloudprovider_aws_access_key="{{ lookup('env','AWS_ACCESS_KEY_ID') }}"
( [* [  A' j& v, f#openshift_cloudprovider_aws_secret_key="{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}"
# t7 H" O+ |( s( U2 G0 A#0 Y5 i& _8 z) q" C/ k% A2 Z6 M
# AWS4 w, k& A8 S' G/ c* d4 e9 Z1 P4 b
#openshift_cloudprovider_kind=aws
% r: ~  Y- U; i. u! i# Note: IAM profiles may be used instead of storing API credentials on disk.
& v4 ~4 m5 i/ g/ _$ u5 s#openshift_cloudprovider_aws_access_key=aws_access_key_id
3 L0 R9 k' W  q  p8 s& H8 X#openshift_cloudprovider_aws_secret_key=aws_secret_access_key
- m! s2 }3 [" q6 \' _" v, q7 tWhen Ansible configures AWS, the following files are created for you:
. E: @! ^1 Y0 [3 B5 U7 ?
! n0 b) C2 \; w" ]% J( l; [1 V/etc/aws/aws.conf
' N0 o8 N- v+ B& C' l6 h
' _) C- r+ I& K' F/etc/origin/master/master-config.yaml
' x7 F8 s2 W8 U  j
' h" G9 I  |* J" A/etc/origin/node/node-config.yaml2 ]6 R: U) ?+ ~3 @# t* B
- X% I6 r# Y' R6 X- ^5 \/ J4 ?
/etc/sysconfig/atomic-openshift-master9 y: y0 H# U8 ~! k1 v7 N

( B- n$ l5 m: L2 E% h! ^/etc/sysconfig/atomic-openshift-node: H7 `4 ]( i6 [1 O- N' Z
0 Q4 K: R3 ^4 a1 S  V7 s9 u6 W! N0 B
Manually Configuring OpenShift Container Platform Masters for AWS
4 J% T% q/ g$ y+ z' [( PEdit 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:
" M. D6 E" b: p. a
: R+ H/ k; B* n4 M9 ^kubernetesMasterConfig:, V6 ~+ ?3 V6 ?6 B' _* s5 I3 H2 s; Z
  ...
: E+ k" v$ @( x  m  apiServerArguments:
% \  \# V# E" B7 T9 e    cloud-provider:& a: \8 ^* ~- {6 `
      - "aws"2 ~' e. Q5 j0 M# ]+ ^* Q: K
    cloud-config:) b; _4 _9 r& C  J' o' S/ `8 A) o) ~
      - "/etc/aws/aws.conf"
" {  l# R. T% V) ?& m" ]( Z) B  controllerArguments:2 E* o: {5 m: @0 b$ l0 q8 ?
    cloud-provider:
8 E% L' f7 c% X: Q      - "aws"" J( J# D- z8 ?' i; u1 q
    cloud-config:3 k8 C' Z  H3 @0 X
      - "/etc/aws/aws.conf"5 b9 B7 S7 e' B! p2 [% A+ B
Currently, 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.+ ~0 }5 K& f( ~; C0 i$ J+ y

- L; S% G5 t7 w) [& zWhen 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/.
/ l! d6 O' k1 {; k) tManually Configuring OpenShift Container Platform Nodes for AWS
( I( i# C: d) f% X6 L3 g* `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:
" m* d0 R- A9 D( I9 i( Y1 u, J1 e9 U; |* |6 [: i; Y0 t
kubeletArguments:/ V( U$ j" _" w* i3 j+ V! r# C
  cloud-provider:$ b2 F% i" C, A
    - "aws"
1 L- x4 o2 ~- V" J  h! Y  cloud-config:
% V7 p& Y7 Z; K! b  Z0 o    - "/etc/aws/aws.conf"
6 o, q" ?+ v- tWhen 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 i1 V0 \2 c$ Y0 N7 K: a
Setting Key Value Access Pairs# _) J* Z. P5 X
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:2 M# z, M  e9 {& n7 R' f0 a3 W" R
9 _; }  _8 P1 C: x) ]: }* ~# [6 _
AWS_ACCESS_KEY_ID=<key_ID>& c' h8 x4 i& h0 V7 h
AWS_SECRET_ACCESS_KEY=<secret_key>
) a* q( {: V: P) G" zAccess keys are obtained when setting up your AWS IAM user.
) R: |* d; F6 [- Y' m2 JApplying Configuration Changes
; M9 Q* I; `, ~& ?* T" K& U  G' aStart or restart OpenShift Container Platform services on all master and node hosts to apply your configuration changes:
& z: U& V, J' ]0 B9 h0 i) h1 o  y$ _
$ systemctl restart atomic-openshift-master
3 d) O6 `5 b9 z! E3 s3 W  O. Y! w$ systemctl restart atomic-openshift-node# {' j! [7 X' I$ n0 v
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:' T: }  p. i. w2 `7 u# H
  _5 e, n8 A/ O4 z% D3 G6 A7 \
Log in to the CLI as a cluster administrator.
* N+ U9 C' [: r8 f1 x1 R4 z
9 l) m; x$ @. rCheck and backup existing node labels:: N5 k9 ?) }) Z. n6 ~7 P

, @0 F9 `2 l- H2 A$ oc describe node <node_name> | grep -Poz '(?s)Labels.*\n.*(?=Taints)'
" h  ^) ?- G; Y9 oDelete the nodes:. D% n# R* X3 P# I
1 X' f& |  s9 `# L$ f
$ oc delete node <node_name>& T7 Q5 c3 g# h5 w5 _1 [2 F' V
On each node host, restart the OpenShift Container Platform service.  Z2 K- F9 [( L2 X

0 j8 E( S* Z4 [. d7 a$ systemctl restart atomic-openshift-node  k3 h8 n: a. n  J
Add back any labels on each node that you previously had
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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