Reputation: 93
I have a knative setup with two worker nodes. After successfully testing helloworld-go sample program. I tried to wrote a simple C program that just prints environment variable "REQUEST_METHOD" and "QUERY_STRING". However pod status is "CrashLoopBackOff" and kubectl describe shows: " Readiness probe failed: Get http://192.168.203.181:8022/health: net/http: request canceled (Client.Timeout exceeded while awaiting headers)". I suspect something is wrong with my code. If possible please suggest what is wrong with my code. Dockerfile I used is this:
FROM gcc:4.9
COPY . /usr/src/test-c
WORKDIR /usr/src/test-c
RUN gcc -o test-c main.c
CMD ["./test-c"]
My C code for the same is:
#include <stdio.h>
#include <stdlib.h>
int main() {
char* len_ = getenv("REQUEST_METHOD");
printf("METHOD = %s, %s\n", len_, getenv("QUERY_STRING"));
}
My yaml file is:
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
name: helloworld-c
namespace: default
spec:
template:
spec:
containers:
- image: docker.io/avinashkrc/helloworld-c:latest
env:
- name: TARGET
value: "Go Sample"
Upvotes: 0
Views: 462
Reputation: 93
I am able to solve the problem using pistache for REST api (I guess any framework should work).
Upvotes: 0