Skip to content

Instantly share code, notes, and snippets.

@cdemers
Last active September 14, 2017 19:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdemers/be415cb46327e56c5c47f9689a07a456 to your computer and use it in GitHub Desktop.
Save cdemers/be415cb46327e56c5c47f9689a07a456 to your computer and use it in GitHub Desktop.
Install the socat binary into a CoreOS installation
# Insightful instructions, originally posted by Xynova (https://github.com/xynova)
# Make socat directories
mkdir -p /opt/bin/socat.d/bin /opt/bin/socat.d/lib
# Create socat wrapper
cat << EOF > /opt/bin/socat
#! /bin/bash
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/bin
LD_LIBRARY_PATH=/opt/bin/socat.d/lib:$LD_LIBRARY_PATH exec /opt/bin/socat.d/bin/socat "\$@"
EOF
chmod +x /opt/bin/socat
# Get socat and libraries from the CoreOS toolbox
toolbox
dnf install -y socat
cp -f /usr/bin/socat /media/root/opt/bin/socat.d/bin/socat
cp -f /usr/lib64/libssl.so.1.1.0f /media/root/opt/bin/socat.d/lib/libssl.so.1.1
cp -f /usr/lib64/libcrypto.so.1.1.0f /media/root/opt/bin/socat.d/lib/libcrypto.so.1.1
cp -f /usr/lib64/libreadline.so.7.0 /media/root/opt/bin/socat.d/lib/libreadline.so.7
# Then tell the kubelet to consider binaries in the /opt/bin directory .. maybe changing it to a socat specific isolated one is better
# /etc/systemd/system/kubelet.service
# [Unit]
# Description=Kubernetes Kubelet Master
# Documentation=http://kubernetes.io/docs/admin/kubelet
# [Service]
# ExecStartPre=/usr/bin/mkdir -p /etc/kubernetes/manifests
# ExecStartPre=/usr/bin/mkdir -p /etc/cni/net.d
# ExecStartPre=/usr/bin/mkdir -p /opt/cni/bin
# Environment="PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin"
# ...
@xueshanf
Copy link

xueshanf commented Aug 9, 2017

@cdemers: I have a container install-socat to help with the installation. Thanks for the inspiration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment