易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 3898|回复: 0
收起左侧

Configuring for AWS

[复制链接]
发表于 2018-12-20 01:44:01 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
Configuring for AWS
' N6 y1 K: Q& v; gOverview
5 _9 V1 N! Q* q5 ~  @Configuring AWS Variables
" C7 p0 h' I  N' K7 S9 G% \Configuring OpenShift Container Platform Masters for AWS) |; ?' H0 @9 e+ q, Y
Configuring OpenShift Container Platform for AWS with Ansible4 e. E4 u! h* J; W
Manually Configuring OpenShift Container Platform Masters for AWS! ^# v/ v% f8 t5 f. a8 x" G
Manually Configuring OpenShift Container Platform Nodes for AWS
0 U, r. A) u* C& eSetting Key Value Access Pairs" Y9 L7 e# C8 ^7 l* d
Applying Configuration Changes/ ^) Y4 N" b% k* s2 W( T
Overview
1 a0 H" z! L( POpenShift 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 ~) p& S1 s# _3 Y' F+ w1 T

0 i( [4 B" w# ^' s5 sConfiguring AWS Variables
" {2 [, r. F: v' _. `& _6 FTo 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:3 C( w' x8 S( w( X1 i

% V! T0 `$ {3 u4 x0 l3 l3 I[Global]5 U, S2 P3 `# V# g8 a
Zone = us-east-1c " D# j3 G2 r6 I+ y0 b2 D6 K/ J, Z' i
This is the Availability Zone of your AWS Instance and where your EBS Volume resides; this information is obtained from the AWS Managment Console., U% _  @* t0 w$ p$ m0 F, w& B6 U0 v# u
Configuring OpenShift Container Platform Masters for AWS. z) W% }: s: l+ t2 L
You can set the AWS configuration on your OpenShift Container Platform master hosts in two ways:
% b9 A, `* n4 ^4 x3 i
  |7 w2 @' H2 \  M1 p1 S' Husing Ansible and the advanced installation tool
' v: M! \4 k/ q( r& Z
6 d  [# _: r- ~4 T- a- B7 Xmanually, by modifying the master-config.yaml file& v5 L% n7 U2 |/ P
# V$ V, {$ @8 \3 @  {
Configuring OpenShift Container Platform for AWS with Ansible
1 y5 N* `' Y& J1 iDuring 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.. w+ c/ ^( m' J, d( [# A
( ?5 z: d, E( |. ?0 Y1 k
Example 1. Example AWS Configuration with Ansible
/ z6 L/ J& k" D' g1 Q2 Q0 w6 p# Cloud Provider Configuration6 J" w0 M8 [+ ]+ g
#
( b  @1 F* x9 {% ^/ U2 o) @! O# Note: You may make use of environment variables rather than store
9 ]- Z. F9 E+ b) w# b, N2 p$ Z# sensitive configuration within the ansible inventory.
. M* ]3 G/ L4 H7 o/ a/ p1 `: V# For example:0 }/ Y% u5 Q( f* p+ S7 l
#openshift_cloudprovider_aws_access_key="{{ lookup('env','AWS_ACCESS_KEY_ID') }}"( Z5 v. [- X7 i7 c- z/ B
#openshift_cloudprovider_aws_secret_key="{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}"5 W9 R7 F4 u: z0 [4 |& c
#) T. `2 w9 k* k) ]  v
# AWS2 l3 L6 p$ ?" e
#openshift_cloudprovider_kind=aws4 n# T5 K  n+ ^
# Note: IAM profiles may be used instead of storing API credentials on disk.
3 w* I- J# N; s0 D+ t( ?#openshift_cloudprovider_aws_access_key=aws_access_key_id8 S# a, p5 Z, B: ^! G
#openshift_cloudprovider_aws_secret_key=aws_secret_access_key
' p( b2 B5 s+ D' h: I  Z- ~When Ansible configures AWS, the following files are created for you:4 c6 D1 P1 E) O  p7 g9 i
/ }8 H7 n0 o- v% u  F
/etc/aws/aws.conf
; `8 O7 t  _; {7 A3 R) x  w
2 x& Z6 O0 f0 J/etc/origin/master/master-config.yaml
3 `$ g/ L6 a' c- }2 ]% X/ {3 [0 ]
* ?6 w$ T! {1 P  k6 s% `1 k: [/etc/origin/node/node-config.yaml7 P$ r6 ?! `' U! W
. E, X% t+ l" x
/etc/sysconfig/atomic-openshift-master/ Y4 Y6 }. Z% y9 v. j
$ l* w9 V% b5 J+ d/ `
/etc/sysconfig/atomic-openshift-node1 b" h, M1 m2 @, I" D; R! f/ r
7 d; g! U0 q- s* z3 |5 r- Y# i
Manually Configuring OpenShift Container Platform Masters for AWS
2 F' S; |) N; K6 j" Y& ^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:
) l/ T3 O2 U5 I+ J6 O9 d" P' [( ?' I7 o9 y$ u* F2 r
kubernetesMasterConfig:
) O* w: o3 U5 s  ...
: h, B$ q7 L. j! r( h  apiServerArguments:+ K/ I$ v+ F9 P) _# q5 b
    cloud-provider:4 P0 e* \! M: r& f/ k
      - "aws"% \* y. ~$ O7 @% e$ s# w' k
    cloud-config:7 o6 }8 ?# i% i( o) m  ~
      - "/etc/aws/aws.conf"6 x$ y% ]7 M+ w5 I2 X
  controllerArguments:* p: |3 q  u1 W( M9 O/ i; w! }
    cloud-provider:
7 p6 `$ I* T, Z0 T0 {2 C      - "aws"2 g% B" X# X  J1 ?9 \5 l6 T
    cloud-config:
' U: h6 P8 n$ P: h      - "/etc/aws/aws.conf"# ^2 ~, f, Q! @7 a7 E8 f* b. A
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.! N4 C' f' D( v; F

# _8 D: T# u; h  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/." x$ N2 L  m- C# O, L9 w7 c6 r; _2 _
Manually Configuring OpenShift Container Platform Nodes for AWS
2 @& P4 q2 H, D2 N% B. IEdit 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:
4 d( N; G- \. h1 h* c! m3 N
7 {6 e6 Q) y: l7 F# b0 FkubeletArguments:) Y+ s9 G1 [5 G: `
  cloud-provider:5 i: S/ ^* B; G6 W# ]0 i7 T
    - "aws"
% Z" N. k5 {# J% O( I7 {4 U+ ~  cloud-config:# M- E0 O% n4 }0 t& M3 s
    - "/etc/aws/aws.conf"! a9 t( A- A4 h/ E; g8 f# J; N
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/.
/ y9 X( U5 A( {  \7 M$ g/ p. ]4 {Setting Key Value Access Pairs
# w8 w/ g. f6 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:# _$ B+ I, X* f3 T5 ]

! ~8 O2 o$ l, y% D; WAWS_ACCESS_KEY_ID=<key_ID>  ^) d# I. ^; |" `) G9 |! y
AWS_SECRET_ACCESS_KEY=<secret_key>6 E  j% g. k5 H8 ?9 ?* }' }: x  \
Access keys are obtained when setting up your AWS IAM user.
$ W6 J. T- }: y, |1 C/ O5 _# w2 r3 d1 HApplying Configuration Changes, Z$ U3 k/ z4 r9 i- {6 E% \" D
Start or restart OpenShift Container Platform services on all master and node hosts to apply your configuration changes:
5 u/ M" U0 {" D) [8 D- b  q4 p9 }2 k3 o# y3 N* i) A" ]1 |" |0 ^
$ systemctl restart atomic-openshift-master" X; C! Z; x# n! j
$ systemctl restart atomic-openshift-node
; W+ d9 l% a/ R3 CSwitching 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:8 O# E5 k* G  T/ G6 Q
5 g& z7 m$ {& z0 @( H
Log in to the CLI as a cluster administrator.
( _7 l# |4 W4 ], U+ P8 o
" D& c5 T. y; ~* M- k3 sCheck and backup existing node labels:
" }  `$ B2 O1 U4 E5 w
& p4 O7 k, C% Y* Q3 h; f$ oc describe node <node_name> | grep -Poz '(?s)Labels.*\n.*(?=Taints)'
" q3 P+ `7 N8 w/ X: wDelete the nodes:$ b; h' @" i* u3 O0 l

% N0 s7 N2 G1 S3 R" k& s4 m% P$ oc delete node <node_name>' N" x: D# u& a
On each node host, restart the OpenShift Container Platform service.
! T5 E) k, L; r$ e1 |; R3 c- A8 j- x/ ?) {, N7 f4 ^$ T4 \# `- [, G
$ systemctl restart atomic-openshift-node
9 M6 I/ i: |8 I, B4 QAdd back any labels on each node that you previously had
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 点击这里给我发消息

GMT+8, 2026-4-8 12:05 , Processed in 0.051880 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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