Install openshift 4 on aws

Before proceeding make sure you have a domain in aws(route 53)

If you don’t have visit https://console.aws.amazon.com/route53/ and get it.

For now i have purchased redhatocp.com 

[root@localhost tmp]# yum install awscli

Note: Create IAM role with admin access

[root@localhost tmp]# aws configure
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]: us-east-1
Default output format [None]:

Go to https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/

[root@localhost tmp]# mkdir tmp

[root@localhost tmp]# cd tmp

[root@localhost tmp]#  wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux-4.1.0-rc.5.tar.gz

[root@localhost tmp]# tar -xzvf openshift-install-linux-4.1.0-rc.5.tar.gz
README.md
openshift-install

[root@localhost tmp]# ls -l
total 262636
-rwxr-xr-x. 1 root root 216764576 May 18 05:42 openshift-install
-rw-r–r–. 1 root root 52165198 May 30 12:22 openshift-install-linux-4.1.0-rc.5.tar.gz
-rw-r–r–. 1 root root 706 May 18 05:42 README.md

 

[root@localhost tmp]# ./openshift-install
Creates OpenShift clusters

Usage:
openshift-install [command]

Available Commands:
completion Outputs shell completions for the openshift-install command
create Create part of an OpenShift cluster
destroy Destroy part of an OpenShift cluster
gather Gather debugging data for a given installation failure
graph Outputs the internal dependency graph for installer
help Help about any command
version Print version information
wait-for Wait for install-time events

Flags:
–dir string assets directory (default “.”)
-h, –help help for openshift-install
–log-level string log level (e.g. “debug | info | warn | error”) (default “info”)

Use “openshift-install [command] –help” for more information about a command.

 

Pull the required secret from  https://cloud.redhat.com/openshift/install

[root@localhost tmp]# ./openshift-install create cluster
? Platform aws
? Region us-east-1
? Base Domain master.redhatocp.com
? Cluster Name testcluster
? Pull Secret [? for help] **********

INFO Creating infrastructure resources…
INFO Waiting up to 30m0s for the Kubernetes API at https://api.cluster.redhatocp.com:6443…
INFO API v1.13.4+f2cc675 up
INFO Waiting up to 30m0s for bootstrapping to complete…
INFO Destroying the bootstrap resources…
INFO Waiting up to 30m0s for the cluster at https://api.cluster.redhatocp.com:6443 to initialize…
INFO Waiting up to 10m0s for the openshift-console route to be created…
INFO Install complete!
INFO To access the cluster as the system:admin user when using ‘oc’, run ‘export KUBECONFIG=/root/tmp/auth/kubeconfig’
INFO Access the OpenShift web-console here: https://console-openshift-console.apps.cluster.redhatocp.com
INFO Login to the console with user: kubeadmin, password: VLgEn-Qmjg6

Download client

[root@localhost ~]# wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux-4.1.0-rc.5.tar.gz

[root@localhost ~]# tar -xzvf openshift-client-linux-4.1.0-rc.5.tar.gz
README.md
oc
kubectl

[root@localhost ~]# export PATH=$PATH:/root

[root@localhost ~]# oc get pods
error: Missing or incomplete configuration info. Please login or point to an existing, complete config file:

1. Via the command-line flag –config
2. Via the KUBECONFIG environment variable
3. In your home directory as ~/.kube/config

To view or setup config directly use the ‘config’ command.

[root@localhost ~]# export KUBECONFIG=/root/tmp/auth/kubeconfig

[root@localhost ~]# oc get nodes
NAME STATUS ROLES AGE VERSION
ip-10-0-132-243.us-west-1.compute.internal Ready worker 23m v1.13.4+27816e1b1
ip-10-0-133-170.us-west-1.compute.internal Ready master 27m v1.13.4+27816e1b1
ip-10-0-137-238.us-west-1.compute.internal Ready worker 23m v1.13.4+27816e1b1
ip-10-0-138-51.us-west-1.compute.internal Ready master 27m v1.13.4+27816e1b1
ip-10-0-148-101.us-west-1.compute.internal Ready worker 23m v1.13.4+27816e1b1
ip-10-0-148-37.us-west-1.compute.internal Ready master 28m v1.13.4+27816e1b1
[root@localhost ~]# oc get users
No resources found.

[root@localhost ~]# oc create user admin
user.user.openshift.io/admin created

[root@localhost ~]# oc adm policy add-cluster-role-to-user cluster-admin admin
clusterrole.rbac.authorization.k8s.io/cluster-admin added: “admin”

[root@localhost ~]# oc get routes –all-namespaces

NAMESPACE NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
openshift-authentication oauth-openshift oauth-openshift.apps.cluster.redhatocp.com oauth-openshift 6443 passthrough/Redirect None
openshift-console console console-openshift-console.apps.cluster.redhatocp.com console https reencrypt/Redirect None
openshift-console downloads downloads-openshift-console.apps.cluster.redhatocp.com downloads http edge None
openshift-monitoring alertmanager-main alertmanager-main-openshift-monitoring.apps.cluster.redhatocp.com alertmanager-main web reencrypt/Redirect None
openshift-monitoring grafana grafana-openshift-monitoring.apps.cluster.redhatocp.com grafana https reencrypt/Redirect None
openshift-monitoring prometheus-k8s prometheus-k8s-openshift-monitoring.apps.cluster.redhatocp.com prometheus-k8s web reencrypt/Redirect None
[root@localhost ~]#

 

This slideshow requires JavaScript.

 

[root@localhost ~]# oc get pods –all-namespaces |grep Running
openshift-apiserver-operator openshift-apiserver-operator-686f499fc9-4l5hl 1/1 Running 1 29m
openshift-apiserver apiserver-5hc2q 1/1 Running 0 23m
openshift-apiserver apiserver-h9jmn 1/1 Running 0 25m
openshift-authentication-operator authentication-operator-6c9d7dc7b-gm54s 1/1 Running 0 24m
openshift-authentication oauth-openshift-cc4fb948-dzgvl 1/1 Running 0 22m
openshift-authentication oauth-openshift-cc4fb948-jrnjv 1/1 Running 0 22m
openshift-cloud-credential-operator cloud-credential-operator-6744c66469-tsqm7 1/1 Running 0 29m
openshift-cluster-machine-approver machine-approver-86df4c9898-9qmqg 1/1 Running 0 29m

 

 

[root@localhost tmp]# ./openshift-install destroy cluster
INFO Deleted arn=”arn:aws:elasticloadbalancing:us-west-1:536751915275:loadbalancer/net/cluster-h48ww-ext/a52ce11cbea79fbf” id=net/cluster-h48ww-ext/a52ce11cbea79fbf
INFO Disassociated arn=”arn:aws:ec2:us-west-1:536751915275:route-table/rtb-0bb487356a24e04be” id=rtbassoc-0ec6a11d9efe3dcec
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:route-table/rtb-0bb487356a24e04be” id=rtb-0bb487356a24e04be
INFO Disassociated arn=”arn:aws:ec2:us-west-1:536751915275:instance/i-0b5f9867943f71da0″ id=i-0b5f9867943f71da0 name=cluster-h48ww-master-profile role=cluster-h48ww-master-role
INFO Deleted InstanceProfileName=cluster-h48ww-master-profile arn=”arn:aws:iam::536751915275:instance-profile/cluster-h48ww-master-profile” id=i-0b5f9867943f71da0
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:instance/i-0b5f9867943f71da0″ id=i-0b5f9867943f71da0
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:instance/i-09b899ecfa8b872ed” id=i-09b899ecfa8b872ed
INFO Deleted arn=”arn:aws:elasticloadbalancing:us-west-1:536751915275:targetgroup/cluster-h48ww-aext/6b5d4c7a3d6474c7″ id=cluster-h48ww-aext/6b5d4c7a3d6474c7
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:image/ami-085f680329ef3b129″ id=ami-085f680329ef3b129
INFO Disassociated arn=”arn:aws:ec2:us-west-1:536751915275:route-table/rtb-0a3cacb8a49569498″ id=rtbassoc-0f63cf10cc463b75f
INFO Disassociated arn=”arn:aws:ec2:us-west-1:536751915275:route-table/rtb-0a3cacb8a49569498″ id=rtbassoc-02a6021ac74931239
INFO Disassociated arn=”arn:aws:ec2:us-west-1:536751915275:instance/i-058a88794f57da606″ id=i-058a88794f57da606 name=cluster-h48ww-worker-profile role=cluster-h48ww-worker-role
INFO Deleted InstanceProfileName=cluster-h48ww-worker-profile arn=”arn:aws:iam::536751915275:instance-profile/cluster-h48ww-worker-profile” id=i-058a88794f57da606
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:instance/i-058a88794f57da606″ id=i-058a88794f57da606
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:natgateway/nat-0dc405235c0887e46″ id=nat-0dc405235c0887e46
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ classic load balancer=ada9791ee82bb11e9a6e8026af279411 id=vpc-07d4ae4098c64e110
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110 load balancer=loadbalancer/net/cluster-h48ww-int/19ba66252c299d90
INFO Deleted NAT gateway=nat-0dc405235c0887e46 arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110
INFO Deleted NAT gateway=nat-052ef00ce3ee83d8f arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:natgateway/nat-052ef00ce3ee83d8f” id=nat-052ef00ce3ee83d8f
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:instance/i-0bebebd6ec5f98d0b” id=i-0bebebd6ec5f98d0b
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:instance/i-021953253ab1f9fe6″ id=i-021953253ab1f9fe6
INFO Deleted arn=”arn:aws:elasticloadbalancing:us-west-1:536751915275:loadbalancer/net/cluster-h48ww-int/19ba66252c299d90″ id=net/cluster-h48ww-int/19ba66252c299d90
INFO Deleted arn=”arn:aws:elasticloadbalancing:us-west-1:536751915275:loadbalancer/ada9791ee82bb11e9a6e8026af279411″ id=ada9791ee82bb11e9a6e8026af279411
INFO Disassociated arn=”arn:aws:ec2:us-west-1:536751915275:route-table/rtb-06ac6b7c4e1ed843a” id=rtbassoc-06c500f7152e6543e
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:route-table/rtb-06ac6b7c4e1ed843a” id=rtb-06ac6b7c4e1ed843a
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:instance/i-04e6cedbb2158e137″ id=i-04e6cedbb2158e137
INFO Deleted arn=”arn:aws:elasticloadbalancing:us-west-1:536751915275:targetgroup/cluster-h48ww-sint/6477060f8a517bec” id=cluster-h48ww-sint/6477060f8a517bec
INFO Deleted arn=”arn:aws:s3:::image-registry-us-west-1-37c0d57608ea4bbfa5aba74b9769f4c9-d375″
INFO Deleted arn=”arn:aws:route53:::hostedzone/Z1KS1Z7Q323TPR” id=Z1KS1Z7Q323TPR record set=”SRV _etcd-server-ssl._tcp.cluster.redhatocp.com.”
INFO Deleted arn=”arn:aws:route53:::hostedzone/Z1KS1Z7Q323TPR” id=Z1KS1Z7Q323TPR record set=”A api-int.cluster.redhatocp.com.”
INFO Deleted arn=”arn:aws:route53:::hostedzone/Z1KS1Z7Q323TPR” id=Z1KS1Z7Q323TPR public zone=/hostedzone/Z38YYWHY2RRTWJ record set=”A api.cluster.redhatocp.com.”
INFO Deleted arn=”arn:aws:route53:::hostedzone/Z1KS1Z7Q323TPR” id=Z1KS1Z7Q323TPR record set=”A api.cluster.redhatocp.com.”
INFO Deleted arn=”arn:aws:route53:::hostedzone/Z1KS1Z7Q323TPR” id=Z1KS1Z7Q323TPR public zone=/hostedzone/Z38YYWHY2RRTWJ record set=”A \\052.apps.cluster.redhatocp.com.”
INFO Deleted arn=”arn:aws:route53:::hostedzone/Z1KS1Z7Q323TPR” id=Z1KS1Z7Q323TPR record set=”A \\052.apps.cluster.redhatocp.com.”
INFO Deleted arn=”arn:aws:route53:::hostedzone/Z1KS1Z7Q323TPR” id=Z1KS1Z7Q323TPR record set=”A etcd-0.cluster.redhatocp.com.”
INFO Deleted arn=”arn:aws:route53:::hostedzone/Z1KS1Z7Q323TPR” id=Z1KS1Z7Q323TPR record set=”A etcd-1.cluster.redhatocp.com.”
INFO Deleted arn=”arn:aws:route53:::hostedzone/Z1KS1Z7Q323TPR” id=Z1KS1Z7Q323TPR record set=”A etcd-2.cluster.redhatocp.com.”
INFO Deleted arn=”arn:aws:route53:::hostedzone/Z1KS1Z7Q323TPR” id=Z1KS1Z7Q323TPR
INFO Deleted arn=”arn:aws:iam::536751915275:role/cluster-h48ww-master-role” id=cluster-h48ww-master-role name=cluster-h48ww-master-role policy=cluster-h48ww-master-policy
INFO Deleted arn=”arn:aws:iam::536751915275:role/cluster-h48ww-master-role” id=cluster-h48ww-master-role name=cluster-h48ww-master-role
INFO Deleted arn=”arn:aws:iam::536751915275:role/cluster-h48ww-worker-role” id=cluster-h48ww-worker-role name=cluster-h48ww-worker-role policy=cluster-h48ww-worker-policy
INFO Deleted arn=”arn:aws:iam::536751915275:role/cluster-h48ww-worker-role” id=cluster-h48ww-worker-role name=cluster-h48ww-worker-role
INFO Deleted arn=”arn:aws:iam::536751915275:user/cluster-h48ww-cloud-credential-operator-iam-ro-6zbl7″ id=cluster-h48ww-cloud-credential-operator-iam-ro-6zbl7 policy=cluster-h48ww-cloud-credential-operator-iam-ro-6zbl7-policy
INFO Deleted arn=”arn:aws:iam::536751915275:user/cluster-h48ww-cloud-credential-operator-iam-ro-6zbl7″ id=cluster-h48ww-cloud-credential-operator-iam-ro-6zbl7
INFO Deleted arn=”arn:aws:iam::536751915275:user/cluster-h48ww-openshift-image-registry-wf2l8″ id=cluster-h48ww-openshift-image-registry-wf2l8 policy=cluster-h48ww-openshift-image-registry-wf2l8-policy
INFO Deleted arn=”arn:aws:iam::536751915275:user/cluster-h48ww-openshift-image-registry-wf2l8″ id=cluster-h48ww-openshift-image-registry-wf2l8
INFO Deleted arn=”arn:aws:iam::536751915275:user/cluster-h48ww-openshift-ingress-tlw72″ id=cluster-h48ww-openshift-ingress-tlw72 policy=cluster-h48ww-openshift-ingress-tlw72-policy
INFO Deleted arn=”arn:aws:iam::536751915275:user/cluster-h48ww-openshift-ingress-tlw72″ id=cluster-h48ww-openshift-ingress-tlw72
INFO Deleted arn=”arn:aws:iam::536751915275:user/cluster-h48ww-openshift-machine-api-qpxft” id=cluster-h48ww-openshift-machine-api-qpxft policy=cluster-h48ww-openshift-machine-api-qpxft-policy
INFO Deleted arn=”arn:aws:iam::536751915275:user/cluster-h48ww-openshift-machine-api-qpxft” id=cluster-h48ww-openshift-machine-api-qpxft
INFO Deleted arn=”arn:aws:elasticloadbalancing:us-west-1:536751915275:targetgroup/cluster-h48ww-aint/497a4c7875f539f2″ id=cluster-h48ww-aint/497a4c7875f539f2
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:subnet/subnet-0a370656fa3ea9543″ id=subnet-0a370656fa3ea9543
INFO Released arn=”arn:aws:ec2:us-west-1:536751915275:elastic-ip/eipalloc-00d4937e0f42bd5ca” id=eipalloc-00d4937e0f42bd5ca
INFO Released arn=”arn:aws:ec2:us-west-1:536751915275:elastic-ip/eipalloc-0590367b9df4a85cb” id=eipalloc-0590367b9df4a85cb
INFO Deleted NAT gateway=nat-0dc405235c0887e46 arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110
INFO Deleted NAT gateway=nat-052ef00ce3ee83d8f arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:snapshot/snap-00cbca52dfcfbb259″ id=snap-00cbca52dfcfbb259
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:internet-gateway/igw-045b79f401f826f71″ id=igw-045b79f401f826f71
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:security-group/sg-0e5143167b737daed” id=sg-0e5143167b737daed
INFO Deleted NAT gateway=nat-0dc405235c0887e46 arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110
INFO Deleted NAT gateway=nat-052ef00ce3ee83d8f arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110 network interface=eni-07e336997d5f75277
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110 network interface=eni-09773bb8465f3c8c0
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110 network interface=eni-0ea8bc62791a8fd79
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110 table=rtb-0104dc29ca7f5177a
INFO Deleted VPC endpoint=vpce-0ec05d3f71e16dc05 arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:security-group/sg-0d7fb5571a4980209″ id=sg-0d7fb5571a4980209
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:subnet/subnet-065cdee84cfa6eb9c” id=subnet-065cdee84cfa6eb9c
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:subnet/subnet-09e3f56a145e71b72″ id=subnet-09e3f56a145e71b72
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:security-group/sg-0fcd2b513242e8ad6″ id=sg-0fcd2b513242e8ad6
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:subnet/subnet-02dd67b50c0df7f2e” id=subnet-02dd67b50c0df7f2e
INFO Deleted NAT gateway=nat-0dc405235c0887e46 arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110
INFO Deleted NAT gateway=nat-052ef00ce3ee83d8f arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:vpc/vpc-07d4ae4098c64e110″ id=vpc-07d4ae4098c64e110
INFO Deleted arn=”arn:aws:ec2:us-west-1:536751915275:dhcp-options/dopt-0e6b52f5b87670997″ id=dopt-0e6b52f5b87670997

 

 

 

 

 

 

Leave a comment