Description:
In OpenShift, the ping utility fails by default due to restricted security policies. This is because:
OpenShift enforces a default SecurityContextConstraints (SCC) policy that:
Disallows CAP_NET_RAW (required by ping)
Runs containers as non-root users
These constraints prevent the use of ICMP-based tools like ping
Problem:
Current logic uses ping to test network connectivity (e.g., ping ), which fails in OpenShift environments with:
ping: permission denied (are you root?)
Proposed Solution:
Replace ping with curl, nc, or other TCP-based tools that do not require CAP_NET_RAW. These tools are compatible with OpenShift’s restricted SCC policies and provide similar connectivity validation.
Example Replacement:
curl -sSf http://: || echo "unreachable"
or
nc -z
Benefits:
Works in OpenShift clusters without needing elevated privileges or custom SCCs
Improves portability and compliance with Kubernetes security standards
Simplifies deployment in enterprise and cloud-native environments
Environment Affected:
OpenShift 4.x+
Any cluster using restricted or default SCCs
Request:
Update relevant scripts/configuration to use TCP-based connectivity checks instead of ping.