how to make curl available in my container in k8s pod?

1/26/2022

I'm using busybox image in my pod. I'm trying to curl another pod, but "curl is not found". How to fix it?

apiVersion: v1
kind: Pod
metadata:
  labels:
    app: front
  name: front
spec:
  containers:
  - image: busybox
    name: front
    command:
    - /bin/sh
    - -c
    - sleep 1d

this cmd:

k exec -it front -- sh
curl service-anotherpod:80 -> 'curl not found'
-- ERJAN
curl
kubernetes
networking

2 Answers

1/26/2022

busybox is a single binary program which you can't install additional program to it. You can either use wget or you can use a different variant of busybox like progrium which come with a package manager that allows you to do opkg-install curl.

-- gohm'c
Source: StackOverflow

1/26/2022

Additional to @gohm'c's answer, you could also try uusing Alpine Linux and either make your own image that has curl installed, or use apk add curl in the pod to install it.

Example pod with alpine:

apiVersion: v1
kind: Pod
metadata:
  labels:
    app: front
  name: front
spec:
  containers:
  - image: alpine
    name: front
    command:
    - /bin/sh
    - -c
    - sleep 1d
-- Blender Fox
Source: StackOverflow