-1

I deployed a service on kubernetes and then I wanted to test it out inside the cluster itself, before I put an ingress rule to access it outside.

So, after I verified from the log that the service is running.

I tried to create a pod and get to the shell in it via

kubectl run -i --tty ubuntu --image=ubuntu --restart=Never -- sh

This seems to work fine. I am shown an ubuntu shell, and it seems to work fine.

But then if I do a curl: example

curl --location --request GET 'http://127.0.0.1:9000/hello'

I get a response sh: 4: curl: not found

So then I tried,

apt-get install curl which gives me:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package curl

Thought this was because of sudo. so I did sudo apt-get install curl, but that tells me sh: 6: sudo: not found

Tried installing sudo with apt-get install sudo but that just gives

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package sudo

What am I missing here?

The 0bserver
  • 826
  • 9
  • 18
  • It does. I also did answer my own question after I did find the answer myself from other sources. (not sure why my google foo was not good enough). – The 0bserver Dec 21 '20 at 12:23
  • Then please accept the duplicate nominations. Duplicate questions are a problem because they fragment the knowledge on a particular topic; having your question closed as a duplicate will help those who use the terms in your question find it better in Google going forward, while still showing them where to find the properly peer-reviewed answers. – tripleee Dec 21 '20 at 12:25

1 Answers1

4

It seems I just needed to update apt-get.

It seems when you do get into such a pod, you are working in as root user. Just do apt-get update and then later you can do apt-get install curl. And that works.

And if yours is an alpine one, instead of apt, it would be

apk add curl

The 0bserver
  • 826
  • 9
  • 18