I have two containers in my POD. First container is my main application and second is used as sidecar container having following images having following Dockerfile.
FROM scratch
EXPOSE 8080
ADD my-binary /
ENV GOROOT=/usr/lib/go
ENTRYPOINT ["/my-binary"]
Basically it's using scratch and my-binary is a go application which running as process. So I cannot exec on this side car container. I have a requirement to re-start the side container(my-binary), but there should be no change in the main container. Main container should not be altered in any way.
Is there any possibility, how I can achieve this?
Thank you so much for looking into this.
Someone has asked to provide the complete details of POD, then you can consider following pod structure
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
labels:
app: my-deploy
spec:
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: main
image: my-main-app-image
ports:
- containerPort: 80
- name: my-go-binary
image: my-go-binary-image
Please note-
kubectl exec POD_NAME -c CONTAINER_NAME reboot
this is not going to work for 2nd container as it is scratch image.