易陆发现互联网技术论坛

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

Configuring for AWS

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

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

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

x
Configuring for AWS
# ^* p+ B8 E! L1 `7 FOverview, y' e1 s: M) }, \' _$ I7 Y
Configuring AWS Variables/ Y% h- I0 l3 }
Configuring OpenShift Container Platform Masters for AWS5 W( T% z6 r5 f" \5 i+ t3 ?' L
Configuring OpenShift Container Platform for AWS with Ansible5 p" t6 k! l: D; s3 l3 Y; C/ l
Manually Configuring OpenShift Container Platform Masters for AWS0 X. Q: s, ]) s3 `9 [4 f
Manually Configuring OpenShift Container Platform Nodes for AWS! d$ x, g2 T1 E& i4 Q% K7 d
Setting Key Value Access Pairs
. w& D1 |6 s! L. F% L* ]5 u5 tApplying Configuration Changes; S/ f% N# E/ Z, j0 B
Overview6 h7 z' f# Z" j  s* g$ R4 x
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.8 \* m# B8 W9 P7 G

& n) z, }6 b" E2 D7 O8 m4 q3 yConfiguring AWS Variables
1 g+ c! N: {+ B+ C& \& [) W, VTo 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:/ P: q1 ?, Q' H6 t# @

$ \$ q* C% ~! {  d[Global]: x" W, g- \. a: c) E$ w
Zone = us-east-1c ; l# b: ]! t) f! |/ X  V
This is the Availability Zone of your AWS Instance and where your EBS Volume resides; this information is obtained from the AWS Managment Console.* X' A+ n# G! o8 ^4 }1 m5 S2 u/ T
Configuring OpenShift Container Platform Masters for AWS
- G0 E  _" N7 S8 ~You can set the AWS configuration on your OpenShift Container Platform master hosts in two ways:. Q, L# k9 U. ?6 T8 y, L- q. g

) d" Z/ [( a3 R; g3 qusing Ansible and the advanced installation tool
; Y4 L$ k/ P' C* K8 C1 x3 \3 v# e5 V$ K! M
manually, by modifying the master-config.yaml file7 z  ~$ X+ n% C0 q& q; q4 b

% e0 {7 ]6 T9 |- z( e9 x. G3 b. ^Configuring OpenShift Container Platform for AWS with Ansible
8 P+ d) C  k( r/ oDuring 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 m$ p2 T3 ?3 L$ ~0 t/ ?! |& v* B/ r7 ]% X0 o+ R- o
Example 1. Example AWS Configuration with Ansible* _0 s/ l/ S! E% p
# Cloud Provider Configuration2 z7 ?' j: I5 @" P+ H
#
: x- e: `8 }4 H1 k. f# Note: You may make use of environment variables rather than store
' v( s0 J1 u8 Y3 Z# sensitive configuration within the ansible inventory.* d9 i; ]+ b& @7 C
# For example:
. ?/ U  L, `2 I! G- ?8 x* {7 w#openshift_cloudprovider_aws_access_key="{{ lookup('env','AWS_ACCESS_KEY_ID') }}"
' ^7 G( Q: G3 b#openshift_cloudprovider_aws_secret_key="{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}"& f; V; t# ~" s6 u' Z$ L2 w
#
' A5 ?: i. A9 j( l( C# AWS  Y+ p* O( z- S! F3 m  ]# S
#openshift_cloudprovider_kind=aws& s, r3 z5 ^8 H7 P0 c! b. r
# Note: IAM profiles may be used instead of storing API credentials on disk.
$ K: i' c9 t8 g- p8 G& r& q#openshift_cloudprovider_aws_access_key=aws_access_key_id
  s& h* o# s7 d. A#openshift_cloudprovider_aws_secret_key=aws_secret_access_key
! t! e$ d! y- S5 {# z, aWhen Ansible configures AWS, the following files are created for you:- V7 k: j" q9 P7 n" M

1 U% ?; Z" R" L5 Q  ]7 W6 q/etc/aws/aws.conf
9 J& i+ ~! C5 M5 h
* ^& _% i) u1 \( g/etc/origin/master/master-config.yaml8 F2 Z1 x" ?: l) A$ k1 }
4 o0 Q! S9 H: @4 n$ Y+ b9 e
/etc/origin/node/node-config.yaml
7 C0 W' B( i5 J8 t" e7 |; f4 O6 @
" Y6 j* X; H0 _9 m/etc/sysconfig/atomic-openshift-master
) S7 E$ W- R3 H4 l& v
; x& \7 o5 U( o5 L$ n* \/etc/sysconfig/atomic-openshift-node
3 o( y. v( U, H! V0 _) x6 j
1 n8 U, F& I. L( YManually Configuring OpenShift Container Platform Masters for AWS
& u* ]+ c2 U0 r9 FEdit 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:
& y/ W  y1 l- b3 q* V& v8 T% K/ j
kubernetesMasterConfig:
2 U/ [) G- c  q* L) e  ...
9 v- c0 i- S$ w5 i5 c  apiServerArguments:' K/ u+ E# q  q1 P& Q: V* H6 z
    cloud-provider:
. f) N& K6 C$ {7 G1 u      - "aws"6 Q' V6 k7 Y0 X' [% `6 c
    cloud-config:
1 i% Y, {: G- g7 m' Y. q      - "/etc/aws/aws.conf"! J! N8 E  C+ g! s
  controllerArguments:
! X; h6 B; h( Z. |" e& ~+ G    cloud-provider:( R/ f# A/ I4 E- p; ~7 W
      - "aws"+ E8 t  W" s+ x  x
    cloud-config:
. [* \9 v4 Y+ M! b8 {! X9 W      - "/etc/aws/aws.conf"
5 q9 x( r  f; ]! y* xCurrently, 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.( Y& C7 l  M5 C
- s6 l+ U9 z7 m2 i. E9 X% K# D
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/.5 m  o& d+ o$ _: f' F7 T" c
Manually Configuring OpenShift Container Platform Nodes for AWS5 g6 m" G3 Y# S# X. z* q% s
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:9 K& _, k0 ?7 w

( y3 y! C' z1 g- @kubeletArguments:8 ]$ t# k- g0 B- o+ w, k. ~
  cloud-provider:
* D2 Q* ~, a# s. g% ]  Q% V    - "aws"+ \+ r+ ^% E+ \0 j% k( e
  cloud-config:
; V0 s" l5 K! u    - "/etc/aws/aws.conf"+ k. o5 w* l+ y9 P/ f/ z  R
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 ?/ [9 T% d* ?# l
Setting Key Value Access Pairs8 a+ L3 J" b: x1 j0 c6 [" D5 M
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:
+ G3 G" e  F  K! E0 t
+ d- g2 ]$ c% ]+ NAWS_ACCESS_KEY_ID=<key_ID>
- g% Z5 x* ~5 OAWS_SECRET_ACCESS_KEY=<secret_key>1 w6 E0 r7 i8 F
Access keys are obtained when setting up your AWS IAM user.
5 P; L' k& F- p$ uApplying Configuration Changes4 [3 |  j, u% b5 h/ s
Start or restart OpenShift Container Platform services on all master and node hosts to apply your configuration changes:
( N3 v/ Z) p* H& [' @  t& l" R2 X  v) U- C' S. ^% Y7 S8 \/ L0 n
$ systemctl restart atomic-openshift-master# \. g- e0 ?' m5 _' D9 |0 S' F. U9 d
$ systemctl restart atomic-openshift-node$ ~+ a; B, R' O+ F) U7 [
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:6 R3 b1 Z; M" I% T

' D: E( A& w7 z/ uLog in to the CLI as a cluster administrator." [* Y% |9 b% P2 S+ {
. I+ n6 S  U) _$ y* q! M
Check and backup existing node labels:2 ]8 D- B' g+ s" [
( O8 j+ h2 t9 a
$ oc describe node <node_name> | grep -Poz '(?s)Labels.*\n.*(?=Taints)'1 j1 Y8 K" C) {8 A, }5 Y9 k
Delete the nodes:+ X$ C9 k) O3 i

  Y' T% o4 E" p" k7 h; M0 J$ oc delete node <node_name>
8 J7 ^: }% H! }; zOn each node host, restart the OpenShift Container Platform service.# o5 h' ^9 y/ \/ |9 g- p
- u) i; \4 o$ T
$ systemctl restart atomic-openshift-node
# J' f; z+ m' K: Y/ n+ T4 S8 WAdd back any labels on each node that you previously had
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

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

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 23:53 , Processed in 0.048091 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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