Reputation: 23
How to pass container name information for Kubernetes k8s.io client-go app:
execReq = client.CoreV1().RESTClient().Post().
Resource("pods").
Name(solrPod).
Namespace(brConfig.solrOptions.Namespace).
SubResource("exec").
SubResource("solr").
VersionedParams(&corev1.PodExecOptions{
Command: []string{"java", "CorruptFile", "/opt/solr/data"},
Stdin: true,
Stdout: true,
Stderr: true,
}, scheme.ParameterCodec)
like -
kubectl -n namespace exec pod-name -c container-name.
How to pass the container-name via client-go?
Upvotes: 1
Views: 492
Reputation: 61521
I dug through this for a while š. It's an option in your parameters, also here:
execReq = client.CoreV1().RESTClient().Post().
Resource("pods").
Name(solrPod).
Namespace(brConfig.solrOptions.Namespace).
SubResource("exec").
SubResource("solr").
VersionedParams(&corev1.PodExecOptions{
Command: []string{"java", "CorruptFile", "/opt/solr/data"},
Container: []string("containername"), š
Stdin: true,
Stdout: true,
Stderr: true,
}, scheme.ParameterCodec)
āļøā®ļø
Upvotes: 1