[root@ip-172-31-27-232]# mkdir openshift
[root@ip-172-31-27-232]# cd openshift
Step 2: Create a Public Hosted Zone in Route53
[root@ip-172-31-27-232 openshift]# /usr/local/bin/aws route53 create-hosted-zone --name openshift.raj1987.com --caller-reference $(date +%s) --hosted-zone-config Comment="OpenShift Cluster Zone",PrivateZone=false
{
"Location": "https://route53.amazonaws.com/2013-04-01/hostedzone/Z012320138KGX48ACH1HL",
"HostedZone": {
"Id": "/hostedzone/Z012320138KGX48ACH1HL",
"Name": "openshift.raj1987.com.",
"CallerReference": "1761497342",
"Config": {
"Comment": "OpenShift Cluster Zone",
"PrivateZone": false
},
"ResourceRecordSetCount": 2
},
"ChangeInfo": {
"Id": "/change/C0884203OFIDYL4UXY0W",
"Status": "PENDING",
"SubmittedAt": "2025-10-26T16:49:02.911000+00:00"
},
"DelegationSet": {
"NameServers": [
"ns-1035.awsdns-01.org",
"ns-56.awsdns-07.com",
"ns-2036.awsdns-62.co.uk",
"ns-990.awsdns-59.net"
]
}
}
Step 3: Create DNS Records for OpenShift API and Apps
Edit and verify record-set.json:
[root@ip-172-31-27-232 openshift]# vi record-set.json
[root@ip-172-31-27-232 openshift]# cat record-set.json
{
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "api.openshift.raj1987.com",
"Type": "A",
"TTL": 300,
"ResourceRecords": [
{ "Value": "13.220.87.33" }
]
}
},
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "*.apps.openshift.raj1987.com",
"Type": "A",
"TTL": 300,
"ResourceRecords": [
{ "Value": "13.220.87.33" }
]
}
}
]
}
[root@ip-172-31-27-232 openshift]# /usr/local/bin/aws route53 change-resource-record-sets --hosted-zone-id Z012320138KGX48ACH1HL --change-batch file://record-set.json
{
"ChangeInfo": {
"Id": "/change/C0147510273332315O50R",
"Status": "PENDING",
"SubmittedAt": "2025-10-26T16:51:32.280000+00:00"
}
}
Step 4: Verify DNS Records
[root@ip-172-31-27-232 openshift]# /usr/local/bin/aws route53 list-resource-record-sets --hosted-zone-id Z012320138KGX48ACH1HL
{
"ResourceRecordSets": [
{
"Name": "openshift.raj1987.com.",
"Type": "NS",
"TTL": 172800,
"ResourceRecords": [
{
"Value": "ns-1035.awsdns-01.org."
},
{
"Value": "ns-56.awsdns-07.com."
},
{
"Value": "ns-2036.awsdns-62.co.uk."
},
{
"Value": "ns-990.awsdns-59.net."
}
]
},
{
"Name": "openshift.raj1987.com.",
"Type": "SOA",
"TTL": 900,
"ResourceRecords": [
{
"Value": "ns-1035.awsdns-01.org. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400"
}
]
},
{
"Name": "api.openshift.raj1987.com.",
"Type": "A",
"TTL": 300,
"ResourceRecords": [
{
"Value": "13.220.87.33"
}
]
},
{
"Name": "\\052.apps.openshift.raj1987.com.",
"Type": "A",
"TTL": 300,
"ResourceRecords": [
{
"Value": "13.220.87.33"
}
]
}
]
}
Step 5: Download and Extract OpenShift Installer
[root@ip-172-31-27-232 openshift]# curl -O https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 394M 100 394M 0 0 94.2M 0 0:00:04 0:00:04 --:--:-- 94.2M
[root@ip-172-31-27-232 openshift]# tar -xvf openshift-install-linux.tar.gz
README.md
openshift-install
or you can use below if above not work
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux.tar.gz
Step 6: Create OpenShift Install Configuration
[root@ip-172-31-27-232 openshift]# /usr/local/bin/openshift-install create install-config --dir=install-dir
? Platform aws
INFO Credentials loaded from the AWS config using "SharedConfigCredentials: /root/.aws/credentials" provider
INFO Credentials loaded from the "default" profile in file "/root/.aws/credentials"
? Region us-east-1
? Base Domain openshift.raj1987.com
? Cluster Name raj1987
? Pull Secret [? for help] (Paste your Red Hat pull secret) *****************************************************************************************************************************INFO Install-Config created in: install-dir
Note:- Get Your Red Hat Pull Secrethttps://console.redhat.com/openshift/install/aws/user-provisioned
Step7 : Customize install-config.yaml
Edit the file:
[root@ip-172-31-27-232 openshift]# ls
README.md aws awscliv2.zip install-dir openshift-install-linux.tar.gz record-set.json
[root@ip-172-31-27-232 openshift]# cd install-dir/
[root@ip-172-31-27-232 install-dir]# ls
install-config.yaml
[root@ip-172-31-27-232 install-dir]# vi install-config.yaml
[root@ip-172-31-27-232 install-dir]# cat install-config.yaml
additionalTrustBundlePolicy: Proxyonly
apiVersion: v1
baseDomain: openshift.raj1987.com
compute:
- architecture: amd64
hyperthreading: Enabled
name: worker
platform: {}
replicas: 0
controlPlane:
architecture: amd64
hyperthreading: Enabled
name: master
platform: {}
replicas: 1
metadata:
creationTimestamp: null
name: raj1987
networking:
clusterNetwork:
- cidr: 10.128.0.0/14
hostPrefix: 23
machineNetwork:
- cidr: 10.0.0.0/16
networkType: OVNKubernetes
serviceNetwork:
- 172.30.0.0/16
platform:
aws:
region: us-east-1
vpc: {}
publish: External
pullSecret: '{"auths":{"cloud.openshift.com":{"auth":"b3BlbnNoaWZ0LXJlbGVhc2UtZGV2K29jbV9hY2Nlc3NfYWEzY2YwY2QxZGVjNGE0OWFkMjA1ZmI5YWQ0YTA2Njc6UVhERkNCS045WUY2SkE4QzBIQTc0OTBTOVpFVUdMR0EzR
Step 8: Create the OpenShift Cluster
[root@ip-172-31-27-232 install-dir]# cd ..
[root@ip-172-31-27-232 openshift]# ls
README.md aws awscliv2.zip install-dir openshift-install-linux.tar.gz record-set.json
[root@ip-172-31-27-232 openshift]# /usr/local/bin/openshift-install create cluster --dir=install-dir --log-level=info
INFO Credentials loaded from the "default" profile in file "/root/.aws/credentials"
WARNING Making control-plane schedulable by setting MastersSchedulable to true for Scheduler
Step9:-
Here’s a well-structured breakdown with
clear step-by-step headings for deleting OpenShift resources and cleaning up your AWS environment.
Step 1: Delete DNS Records from Route53 Hosted Zone
Use the following command to delete the
api and
apps A records:
/usr/local/bin/aws route53 change-resource-record-sets \
--hosted-zone-id Z00757432LHHICFAJC2KC \
--change-batch '{
"Changes": [
{
"Action": "DELETE",
"ResourceRecordSet": {
"Name": "api.openshift.raj1987.com",
"Type": "A",
"TTL": 300,
"ResourceRecords": [
{ "Value": "13.218.107.56" }
]
}
},
{
"Action": "DELETE",
"ResourceRecordSet": {
"Name": "*.apps.openshift.raj1987.com",
"Type": "A",
"TTL": 300,
"ResourceRecords": [
{ "Value": "13.218.107.56" }
]
}
}
]
}'
Step 2: Delete the Hosted Zone
Once the records are removed, delete the hosted zone:
/usr/local/bin/aws route53 delete-hosted-zone --id Z00757432LHHICFAJC2KC
Step 3: Verify Hosted Zones
List all hosted zones to confirm deletion:
/usr/local/bin/aws route53 list-hosted-zones
Step 4: Destroy the OpenShift Cluster
Use the OpenShift installer to clean up the cluster:
/usr/local/bin/openshift-install destroy cluster --dir=install-dir
Extra part:-
Step 1: Download OpenShift Installer and Client Tools
curl -LO https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-install-linux.tar.gz
Step 2: Extract and Move Binaries
tar -xvf openshift-install-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo mv openshift-install oc kubectl /usr/local/bin/
Step 3: Verify OpenShift Installer Version
/usr/local/bin/openshift-install version
Step 4: Verify OpenShift Client (oc) Version
/usr/local/bin/oc version
Step 5:- To download OC client for window download from below link
https://console.redhat.com/openshift/downloads
Conclusion:-Unlock the power of OpenShift by deploying it on AWS EC2 in this practical, step-by-step course designed for DevOps and Cloud Engineers. Whether you're preparing for real-world projects or certifications, this course walks you through the entire process of setting up a single-node OpenShift cluster on a powerful EC2 instance.
You’ll learn how to:
- Provision and configure an EC2 instance with Elastic IPs
- Set up IAM roles and permissions
- Install and configure AWS CLI
- Deploy OpenShift on a Red Hat Enterprise Linux (RHEL) server
- Validate and manage your OpenShift environment
This course is ideal for professionals looking to gain hands-on experience with OpenShift in a cloud-native environment using AWS.
No comments:
Post a Comment