EX180 OpenShift Flashcards
create deployment
oc create deployment gitea –port 3030
–image=registry.ocp4.example.com:8443/redhattraining/podman-gitea:latest
bind or volume mount security options
Z, ro
Troubleshoot mount file permissions
1) podman unshare ls -l ~/www
2) podman run –rm image-url id -g
3) podman unshare chgrp -R 994 ~/www
Good DB practices
1) Use volume
2) Use private network instead of exposing port
How to load data into postgres
1) If PG container has psql, enter the container and use it
2) If it doesn’t have a psql then use a temp container in same network
Dum postgres db
pg_dump -Fc DATABASE -f BACKUP_DUMP
Import data into postgres
psql -U DATABASE_USER -h DATABASE_CONTAINER \
-d DATABASE_NAME -f /tmp/SQL_FILE
Display socket stats
podman exec -it CONTAINER ss -pant
Run the host ss command withing container namespace
sudo nsenter -n -t CONTAINER_PID ss -pant
Troubleshooting reachability
1) Check logs
2) Check port maps
3) Check port stats
4) if ss command missing then get PID and run ss with nsender
5) Check container binds on 0.0.0.0 instead of 127
6) Inspect container to see which network it uses
7) Inspect if DNS is enabled on network
Troubleshoot volume
1) Check permission on source folder with unshare
2) Check Z option ( ls -Zd /www). result should be container_type instead of default_type
Container PID
podman inspect CONTAINER –format ‘{{.State.Pid}}’