OpenShift: Difference between revisions
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
=Install= | =Install= | ||
==Install Docker== | |||
You will need to google the way to get the repository | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
apt- | sudo apt update && sudo apt -y install docker-ce | ||
systemctl start docker | systemctl start docker | ||
systemctl enable docker | systemctl enable docker | ||
systemctl status docker | systemctl status docker | ||
</syntaxhighlight> | |||
==Set your user to user docker group== | |||
<syntaxhighlight lang="bash"> | |||
sudo usermod -aG docker $USER | |||
</syntaxhighlight> | |||
==Allow insecure Registry== | |||
<syntaxhighlight lang="bash"> | |||
sudo cat << EOF | sudo tee /etc/docker/daemon.json | |||
{ | |||
"insecure-registries" : [ "172.30.0.0/16" ] | |||
} | |||
EOF | |||
</syntaxhighlight> | |||
==Restart Docker== | |||
<syntaxhighlight lang="bash"> | |||
systemctl restart docker | |||
</syntaxhighlight> | |||
==Get OpenShift and copy binaries== | |||
Get the package | |||
<syntaxhighlight lang="bash"> | |||
wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz | wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz | ||
tar -xvzf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz | tar -xvzf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz | ||
cd openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit | cd openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit | ||
sudo mv oc kubectl /usr/local/bin/ | sudo mv oc kubectl /usr/local/bin/ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Make Directory== | |||
The directories are too long so we need to run the code from /opt/openshift | |||
<syntaxhighlight lang="bash"> | |||
cp -r * /opt/openshift | |||
cd /opt/openshift | |||
oc cluster up --public-hostname=your-server-ip | |||
</syntaxhighlight> | |||
==Fix DNS== | |||
'''IMPORTANT''' | '''IMPORTANT''' | ||
Edit the file: openshift.local.clusterup/node/node-config.yml and set dnsIP | Edit the file: openshift.local.clusterup/node/node-config.yml and set dnsIP | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 27: | Line 51: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Also make sure you have the DNS options inside the docker config file | Also make sure you have the DNS options inside the docker config file | ||
<br> | |||
Edit /etc/docker/daemon.json and add this but do not forget the comma if it already has something | Edit /etc/docker/daemon.json and add this but do not forget the comma if it already has something | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> |
Revision as of 02:21, 24 December 2020
Install
Install Docker
You will need to google the way to get the repository
sudo apt update && sudo apt -y install docker-ce
systemctl start docker
systemctl enable docker
systemctl status docker
Set your user to user docker group
sudo usermod -aG docker $USER
Allow insecure Registry
sudo cat << EOF | sudo tee /etc/docker/daemon.json
{
"insecure-registries" : [ "172.30.0.0/16" ]
}
EOF
Restart Docker
systemctl restart docker
Get OpenShift and copy binaries
Get the package
wget https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
tar -xvzf openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz
cd openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit
sudo mv oc kubectl /usr/local/bin/
Make Directory
The directories are too long so we need to run the code from /opt/openshift
cp -r * /opt/openshift
cd /opt/openshift
oc cluster up --public-hostname=your-server-ip
Fix DNS
IMPORTANT Edit the file: openshift.local.clusterup/node/node-config.yml and set dnsIP
dnsIP: "8.8.8.8"
Edit the file openshift.local.clusterup/kubedns/resolv.conf and add
nameserver 8.8.8.8
nameserver 8.8.4.4
Also make sure you have the DNS options inside the docker config file
Edit /etc/docker/daemon.json and add this but do not forget the comma if it already has something
"dns": ["8.8.8.8", "8.8.4.4"]
Start Stop Cluster
sudo oc cluster down
sudo oc cluster up
Pods
OpenShift Pods contain containers. It is recommended one pod per container.
Deployment
There are 3 ways to deploy an openshift container.
- Predefined containers
- Manual
- Dockerfile
- Yaml
- Most flexible
- Openshift Application catalogue
- Predefined application
- Easy to deploy
- Easy to integrate into custom applications
- Source to Image (s2i)
- Fastest to deploy
- Support for several programming language
- Customizable
List of 3.1 commands
- Basic CLI Operations
- types
- login
- logout
- new-project
- new-app
- status
- project
- Application Modification CLI Operations
- get
- describe
- edit
- env
- volume
- label
- expose
- delete
- Build and Deployment CLI Operations
- start-build
- deploy
- rollback
- new-build
- cancel-build
- import-image
- scale
- tag
- Advanced Commands
- create
- update
- process
- run
- export
- policy
- secrets
- Troubleshooting and Debugging CLI Operations
- logs
- exec
- rsh
- rsync
- port-forward
- proxy
oc commands
- sudo oc login
Login so you can do stuff
- sudo oc config view
View configured clusters
- oc project
View current project
- oc status
Show status
- oc get projects
Show all projects
- oc delete project <project_name>
Deleting a project