How to write this docker command with kubectl

3/25/2021

I'd like to use kubectl to run this docker image :

docker run --rm -p 8787:8787 -e PASSWORD=monpassword docker.io/inseefrlab/utilitr:latest

I'm looking for the equivalent kubectl command.

Many thanks in advance !

-- Damien Dotta
docker
kubectl
kubernetes

2 Answers

3/25/2021

Its not that it is not possible, just not the best way to run via an equivalent kubectl command as that would mean running kubectl interactively. But, if that's what you ask, you can use these:

kubectl run utilitr --image=inseefrlab/utilitr:latest

&

kubectl port-forward utilitr 8787:8787
-- rock'n rolla
Source: StackOverflow

3/25/2021

You can create a pod first in the remote cluster and then use port-forward to connect to the pod via localhost:8787

kubectl run <podname> --image=inseefrlab/utilitr:latest --env="PASSWORD=monpassword"
kubectl port-forward <podname> 8787:8787
-- vishalsaugat
Source: StackOverflow