I am using net-ping module in my container which runs on openshift environment as non root user.
I am getting below error when running script in my pod
var ping = require('net-ping') ping.createSession({ retries: 2, timeout: 1000 });
Error:
Error: Operation not permitted at new Socket (/app/api-runtime/.yarn/unplugged/raw-socket-npm-1.7.0-8205b5d49b/node_modules/raw-socket/index.js:47:14) at Object.exports.createSocket (/app/api-runtime/.yarn/unplugged/raw-socket-npm-1.7.0-8205b5d49b/node_modules/raw-socket/index.js:202:9)
I have NET_RAW and NET_ADMIN capabilities added to my custom SCC which I have defined for the service account and this is getting reflected in my pod yaml as well as shown below.
securityContext:
capabilities:
add:
- NET_RAW
- NET_ADMIN
runAsUser: 2000
runAsNonRoot: true
imagePullPolicy: IfNotPresent
I have tried adding setcap CAP_NET_RAW+eip /usr/bin/node but it didnt help
Any way I can fix this. Any help would be appreciated.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.