易陆发现互联网技术论坛

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

Configuring for AWS

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

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

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

x
Configuring for AWS  {1 v( g6 F9 ]
Overview
4 w" F, |5 {) s% X0 u+ M" vConfiguring AWS Variables
- e1 P, _" a/ B7 B: TConfiguring OpenShift Container Platform Masters for AWS5 Y2 L* [! F+ S) j% t) l$ G6 D
Configuring OpenShift Container Platform for AWS with Ansible% I) Q( @/ U& Z7 d! i
Manually Configuring OpenShift Container Platform Masters for AWS" ]* H" b* D# g+ P8 E
Manually Configuring OpenShift Container Platform Nodes for AWS0 g5 Q6 B% s5 K! y4 L! M
Setting Key Value Access Pairs
, |8 L  Q1 X3 K& E$ k9 j. I! }( n, XApplying Configuration Changes* G6 x) ]' h7 X9 r- H, `
Overview
- G* E8 O& h# l4 G1 IOpenShift 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.
) M% I/ o3 u( `0 i* k) ]9 p
' {" t# |6 U/ R8 [Configuring AWS Variables9 b  z1 w7 M; }$ T+ y
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:
- n7 |( h4 T+ H% P) Z' [1 ?, R- c+ Z0 L* q& g% t7 c
[Global]2 |. e) K- q6 T% a
Zone = us-east-1c 2 w" M$ O5 q6 j2 g/ ?% f1 h
This is the Availability Zone of your AWS Instance and where your EBS Volume resides; this information is obtained from the AWS Managment Console.
. b- ~( X) S0 ~  X% t- pConfiguring OpenShift Container Platform Masters for AWS
8 U9 w+ Y' C& r& B* i' R' P. A# YYou can set the AWS configuration on your OpenShift Container Platform master hosts in two ways:& ]+ _6 C: z) d5 Q8 o

' s: M% Q0 r- p* @5 p; G6 _1 dusing Ansible and the advanced installation tool, b+ m+ ?- D$ ]' a' ^

9 Z+ `- Q( @4 _1 _manually, by modifying the master-config.yaml file# I! p3 m2 L+ Y! t6 K1 N( X

' ]3 p+ F( Y* x& I7 iConfiguring OpenShift Container Platform for AWS with Ansible/ K, f/ U0 K8 i- h% D+ Y
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.
3 f: \2 _" W" D+ E2 |3 }) x& h4 r. Y+ i  ]5 C: l7 H2 H
Example 1. Example AWS Configuration with Ansible3 W/ k, K+ g, v- x
# Cloud Provider Configuration& `$ |8 M+ ]& o. D7 O9 q& K
#$ _2 E6 |7 I- O5 P4 h% F
# Note: You may make use of environment variables rather than store/ O1 h: U1 f$ B3 l( X8 ^
# sensitive configuration within the ansible inventory.
- }( b  n9 H) ]. C# For example:
$ c+ B# ^' z2 t" w) `) I9 [9 y/ G#openshift_cloudprovider_aws_access_key="{{ lookup('env','AWS_ACCESS_KEY_ID') }}"
" j0 W+ r2 M) u8 h#openshift_cloudprovider_aws_secret_key="{{ lookup('env','AWS_SECRET_ACCESS_KEY') }}": O! U$ K) T* t
#
" @1 a* k( h2 i$ V, ~# AWS% h) K- s" E, z6 s- E0 y9 l
#openshift_cloudprovider_kind=aws9 G8 u7 t3 J$ j% L- G
# Note: IAM profiles may be used instead of storing API credentials on disk.) C, V: Q1 [) B2 O& w- l
#openshift_cloudprovider_aws_access_key=aws_access_key_id2 C! S8 v7 |* d1 h5 G/ p
#openshift_cloudprovider_aws_secret_key=aws_secret_access_key
5 K: R1 }7 j2 o6 RWhen Ansible configures AWS, the following files are created for you:$ [& H+ ^* _/ h& S, h& ^
% y4 ], c5 H3 J* |# u
/etc/aws/aws.conf
9 K2 o  k) e8 e& R5 m
9 h7 v) C+ e; C, c* h2 ]2 Q/etc/origin/master/master-config.yaml
' f1 U) t; W3 N% J+ m5 N- c
. m& E* p$ x- b) f5 b/ T/etc/origin/node/node-config.yaml
6 V" f0 _2 z3 ?! _+ _
3 o* T. V8 T  [9 d/etc/sysconfig/atomic-openshift-master6 }4 G/ B) G. S4 t0 X, P

* r; T9 T$ B( `5 B* o; C* q/etc/sysconfig/atomic-openshift-node  ?4 r5 v$ {0 }3 ?
3 l" m# U2 f/ e' i: g6 B& W
Manually Configuring OpenShift Container Platform Masters for AWS5 P7 P; {  Q1 B% ?' H. I$ ?
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:1 A4 C+ Q: `4 ]& N4 k, x/ p

/ d' J/ E3 E2 F7 AkubernetesMasterConfig:
. }: y1 ^8 N2 Z7 @5 @  ...
& v# U" n$ w) [% }  apiServerArguments:1 k/ U) d' m7 P( `: v9 e
    cloud-provider:2 y2 ~+ [7 S% ?! c1 Y8 m, c
      - "aws"
: v. C. F1 u( b0 t/ p  L! G    cloud-config:
! J: V" \& y, j; F: H0 Q      - "/etc/aws/aws.conf": c% p0 D& Y  p9 ]$ L
  controllerArguments:
8 R- T* d/ \- J    cloud-provider:
  x/ @( f3 H, |7 q2 ~. s      - "aws"
# l9 O! r" M% d0 H/ }  E3 i& w    cloud-config:
7 Z" M* Y' M: v1 e: a      - "/etc/aws/aws.conf". `' \% i9 E$ \! ^) s8 U( E
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.# U/ R: r& n/ E% _: ~  b
1 x" N. a  e* E: o# M' _1 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/.
1 T# Q, v% r( Y* m; g1 c* l# cManually Configuring OpenShift Container Platform Nodes for AWS1 F: B3 V( o1 l% u
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:
' r9 r5 u+ Z- Y% V$ h& p+ d. `5 n2 [6 t
kubeletArguments:! a' s' K' O* q' f0 i
  cloud-provider:
* _5 ~( V6 D  o; T    - "aws"
+ C" z# W7 [  N1 a* z$ @  cloud-config:4 a, X' R) [" L: R5 `
    - "/etc/aws/aws.conf"
! u4 w8 o% b  C( ]# 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/.
: a. O! L9 z) a) O* s* NSetting Key Value Access Pairs
: z* I5 l$ c3 t2 `5 L1 ZMake 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:
) i5 d( X" {) a6 F1 m; q5 o. d- v+ E# W
AWS_ACCESS_KEY_ID=<key_ID>* i: F% {( `; H1 l$ R- L5 p* _
AWS_SECRET_ACCESS_KEY=<secret_key>
* F9 l0 A2 y7 y$ B+ v( qAccess keys are obtained when setting up your AWS IAM user.! }1 o- ^, G( G4 r" _
Applying Configuration Changes
& b- x0 K, ?/ B2 o5 M0 ~Start or restart OpenShift Container Platform services on all master and node hosts to apply your configuration changes:
0 S8 `2 T) W( p4 z4 Y% B1 h9 P$ u) o, E4 v: ~
$ systemctl restart atomic-openshift-master6 w% n5 R0 C* G: [1 J# N/ F
$ systemctl restart atomic-openshift-node
% u5 }* L' @8 W* V0 t% \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:
* Y. g: Q1 l  [5 G5 x7 e4 t8 _3 p( A6 Z1 |2 A
Log in to the CLI as a cluster administrator.. {: s: u: [- t! z$ i

: j6 u2 k1 F( `; J; r5 TCheck and backup existing node labels:
7 S- D! u8 m$ z! e) u3 P* u* m: T: t( |# |
$ oc describe node <node_name> | grep -Poz '(?s)Labels.*\n.*(?=Taints)'
8 c2 n4 c' F4 m* P0 o) k; DDelete the nodes:2 b/ S( B5 J: K' k9 K" O( B, ^
( T1 }# W0 k! u+ r
$ oc delete node <node_name>
7 M& v6 }3 I: }( a' L3 aOn each node host, restart the OpenShift Container Platform service.5 V, A8 L# n2 s5 M% ?
1 c1 W2 `- s6 p3 M- W4 N
$ systemctl restart atomic-openshift-node
: h; q, ]4 x7 dAdd back any labels on each node that you previously had
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

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

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

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

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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