Red Hatã§OpenShiftã®ãµãã¼ãããã¦ããid:nekopã§ããRHEL 8ããªãªã¼ã¹ãããã®ã§ããããããªç¨éã«ä½¿ã£ã¦ããèªåç¨ã®ãä»äºRHEL 7ãµã¼ãVMãRHEL 8ãã¼ã¹ã¸ã¨ãå¼ã£è¶ããã¾ããã
ã¾ãã¯RHEL 8ãµã¼ãVMãèµ·åãã¦ãåºæ¬çãªãã¼ã«ç¾¤ãã¤ã³ã¹ãã¼ã«ãã¾ããVMã®ãã¼ããsubscription-manager
ã®æé ã¯çãã¾ãã
yum install -y pcp-zeroconf pcp-system-tools sos sysstat podman skopeo buildah git lsof strace tcpdump bash-completion
Insightsãæå¹åãã¦ããã¾ãã
yum install -y insights-client insights-client --register
ãã®ãµã¼ãã§åä½ãã¦ãããããã¯ã¼ã¯ãµã¼ãã¹ã¯NFS (OpenShiftã®NFS PVãã¹ãç¨), Nexus (Javaã¢ããªããã«ãããã¨ãã®jarãã¡ã¤ã«ã®ãã¼ã«ã«ãã£ãã·ã¥), Container Registry (OpenShiftã®å¤é¨ã³ã³ããã¬ã¸ã¹ããªãã¹ãç¨), ZNC (IRC bouncer), Squid (OpenShiftã®ãããã·ç°å¢ãã¹ãç¨)ã§ããOpenShiftã®ãµãã¼ãæ¥åã§ããããèªåã®ã³ã³ããã¼ã«ä¸ã«ãããã¨ã§ãçç£æ§ã大ããåä¸ãã¾ãã
ã¾ãNFSãµã¼ãã§ãããNFSãµã¼ãã¯ã«ã¼ãã«ç©ºéã§åä½ããããæ®å¿µãªããã³ã³ããåã§ãã¾ãããæ®éã«ã»ããã¢ãããã¾ãã
yum install -y nfs-utils mkdir -p /exports chown nobody.nobody /exports chmod 777 /exports cat <<EOF > /etc/exports /exports *(rw) EOF systemctl enable nfs-server --now firewall-cmd --add-service nfs firewall-cmd --runtime-to-permanent
NFSãµã¼ããæ£ããåä½ãã¦ãããã¨ã確èªãã¾ãã
mkdir -p /mnt/test mount $(hostname):/exports /mnt/test touch /mnt/test/testfile ls -l /exports rm /mnt/test/testfile umount /mnt/test
NFS以å¤ã¯ã³ã³ããã«ããªãçç±ããªãã®ã§ãåºæ¬çã«å ¨ã¦ã³ã³ããã«ãã¾ããNexus, Container Registry, ZNCã¯ã¨ãããããªãã£ã·ã£ã«ã¤ã¡ã¼ã¸ã使ãã¾ããã»ãã¥ãªãã£è¦ä»¶ã«ãã£ã¦ã¯ã¤ã¡ã¼ã¸ã®ãªãã«ããè¡ã£ãã»ããè¯ãã§ãããã
以ä¸ã®ãããªæãã§systemdã®unitãã¡ã¤ã«ãè¨è¿°ãã¾ããåä½ã¦ã¼ã¶ã¯å
¨ã¦èªåã®ã¦ã¼ã¶nekop(uid 1000)ã«ãã¦ããã¾ããåæ§ã«docker.io/library/znc
, docker.io/library/registry:2
ãåä½ããã¾ãã
sudo -u nekop mkdir -p /home/nekop/nexus-data cat <<EOF > /etc/systemd/system/nexus.service [Unit] Description=Nexus After=network-online.target Wants=network-online.target [Service] Type=simple ExecStartPre=-/usr/bin/podman stop nexus ExecStartPre=-/usr/bin/podman rm nexus ExecStartPre=/usr/bin/podman pull docker.io/sonatype/nexus ExecStart=/usr/bin/podman run --name nexus --user 1000:1000 -p 8081:8081 -v /home/nekop/nexus-data:/sonatype-work:Z docker.io/sonatype/nexus ExecStop=/usr/bin/podman stop nexus [Install] WantedBy=multi-user.target EOF
Squidã«ã¤ãã¦ã¯ãã®ã¾ã¾ä½¿ããããªã³ã³ãããè¦å½ãããªãã£ãã®ã§ãã³ã³ããã¤ã¡ã¼ã¸ãä½ãã¾ããSquidããã©ã¢ã°ã©ã¦ã³ãã§æ®éã«èµ·åããã¦ãè¯ãã®ã§ãããä»åã¯ãæ軽ã«ubi8-initã³ã³ããã§ã³ã³ããå systemdã§èµ·åãããã¨ããæ¹æ³ãæ¡ç¨ãã¾ãã
以ä¸ã³ã³ãããã«ãã¯RHEL 8ä¸ã§root権éã§ã®æä½ã§ããsquidããã±ã¼ã¸ã¯RHELã®rpmãã£ãã«ã«ãã£ã¦ubiãã£ãã«ã«ã¯ããã¾ãããRHELã®rpmãã£ãã«ã«ã¢ã¯ã»ã¹ããããã«ã¯ãRHELãã¹ãä¸rootã§ã®ã³ã³ãããã«ããå¿ è¦ã§ãã
podman loginã«å©ç¨ãããµã¼ãã¹ã¢ã«ã¦ã³ãã®ã¦ã¼ã¶åã¨ãã¹ã¯ã¼ãã¯Registry Service Accountsããåå¾ãã¦ãã ããã
ã³ã³ããå
systemdãå©ç¨ããããã«ã¯setsebool container_manage_cgroup=on
è¨å®ãå¿
è¦ã§ãããã®è¨å®ããã¦ãããªãã¨ãã³ã³ããã§/sbin/init
ãèµ·åãããã©systemdãåä½ããä½ãèµ·ããªããã¨ããçµæã«ãªãã¾ãã
podman login registry.redhat.io podman pull registry.redhat.io/ubi8-init buildah from --name squid-work registry.redhat.io/ubi8-init buildah run squid-work dnf install -y squid buildah run squid-work systemctl enable squid buildah commit squid-work squid setsebool container_manage_cgroup=on
ä»ã«ãubi8-minimal
ãubi8
ã³ã³ãããã¼ã¹ã«ãã¦ãã«ãããã¦ã¿ãã®ã§ãããã¤ã¡ã¼ã¸ã«ãã£ã¦ã¯èµ·å確èªãããã¨æã£ã¦execãã¦ã³ã³ããå
ããpsã³ãã³ããå®è¡ãããpsã³ãã³ããç¡ãã£ãããã¦å°ãæ¸æãã¾ãããpodman top squid
ãªã©ã¨ããã¨ããã»ã¹ä¸è¦§ãåå¾ã§ããã®ã§ãã¡ãã§ä»£ç¨ã§ãã¾ãã
Squidã®systemd unitãã¡ã¤ã«ãä½æãã¾ããã³ã³ããå
systemdãå©ç¨ããã«ã¯--stop-signal SIGRTMIN+3
æå®ãå¿
è¦ãªã®ã¨ãuidæå®ã¯åé¤ãã¦ããã©ã«ãè¨å®ã«ããå¿
è¦ãããã¾ããsystemdã«ã¯ã³ã³ããå
ã®root権éãå¿
è¦ã¨ãªããuidæå®ã§ãã¼ãã«ã¦ã¼ã¶ãæå®ããã¨systemdãèµ·åãã¾ããã
cat <<EOF > /etc/systemd/system/squid.service [Unit] Description=Squid After=network-online.target Wants=network-online.target [Service] Type=simple ExecStartPre=-/usr/bin/podman stop squid ExecStartPre=-/usr/bin/podman rm squid ExecStart=/usr/bin/podman run --name squid -p 3128:3128 --stop-signal SIGRTMIN+3 localhost/squid ExecStop=/usr/bin/podman stop squid [Install] WantedBy=multi-user.target EOF
æå¾ã«ã¾ã¨ãã¦èµ·åãã¦ãå¤é¨æ¥ç¶ã®è¨±å¯ãè¡ã£ã¦ããã¾ãã§ãã
systemctl daemon-reload systemctl enable nexus znc registry squid --now firewall-cmd --add-service irc firewall-cmd --add-service squid firewall-cmd --add-port 5000/tcp firewall-cmd --add-port 8081/tcp firewall-cmd --runtime-to-permanent
å®éã«ã¯ãã¤ã°ã¬ã¼ã·ã§ã³ã«ããã£ã¦znc.confã®è¨å®ã®è¦ç´ãããã¦ããããæ¢åã®ãã¼ã¿ãrsyncãããDNSã®ã¬ã³ã¼ãã®åãæ¿ããã¨ãã£ãéå¤ãªä½æ¥ãä»ã«ãçºçãã¦ãã¾ããã4æéç¨åº¦ã§æ¢åã®RHEL 7ãµã¼ããRHEL 8ã«ç§»è¡ãããã¨ãã§ãã¾ããã