Kubernetes - Unable to access apache Pod from proxy The Next CEO of Stack OverflowKubernetes equivalent of env-file in Dockerrequests.get(url) return error code 404 from kubernetes api while the response could be get via curl/GETKubernetes Pod fails with CrashLoopBackOffHow to start a pod in command line without deployment in kubernetes?How to map one single file into kubernetes pod using hostPath?unable to access kubernetes dashboard via tokenHow to mount a volume with a windows container in kubernetes?Share nfs volume between kubernetes clustersAccess stateful headless kubernetes externally?Kubernetes - How to acces to service from a web server in pod with a rest request
Audio Conversion With ADS1243
What connection does MS Office have to Netscape Navigator?
Can someone explain this formula for calculating Manhattan distance?
Is there such a thing as a proper verb, like a proper noun?
What would be the main consequences for a country leaving the WTO?
Is dried pee considered dirt?
What steps are necessary to read a Modern SSD in Medieval Europe?
Expectation in a stochastic differential equation
Is French Guiana a (hard) EU border?
Is fine stranded wire ok for main supply line?
what's the use of '% to gdp' type of variables?
TikZ: How to fill area with a special pattern?
Decide between Polyglossia and Babel for LuaLaTeX in 2019
What is the process for cleansing a very negative action
Calculate the Mean mean of two numbers
Is it okay to majorly distort historical facts while writing a fiction story?
From jafe to El-Guest
Spaces in which all closed sets are regular closed
What day is it again?
How did Beeri the Hittite come up with naming his daughter Yehudit?
Is there a difference between "Fahrstuhl" and "Aufzug"?
Is there an equivalent of cd - for cp or mv
Touchpad not working on Debian 9
Easy to read palindrome checker
Kubernetes - Unable to access apache Pod from proxy
The Next CEO of Stack OverflowKubernetes equivalent of env-file in Dockerrequests.get(url) return error code 404 from kubernetes api while the response could be get via curl/GETKubernetes Pod fails with CrashLoopBackOffHow to start a pod in command line without deployment in kubernetes?How to map one single file into kubernetes pod using hostPath?unable to access kubernetes dashboard via tokenHow to mount a volume with a windows container in kubernetes?Share nfs volume between kubernetes clustersAccess stateful headless kubernetes externally?Kubernetes - How to acces to service from a web server in pod with a rest request
I have PHP app+Apache on a Kubernetes POD. The PHP app, access Elasticsearch API on port 9200, and show a simple website, to the users, on port 5000.
I run proxy, using kubectl proxy --address='0.0.0.0' --port=8001 --accept-hosts='.*'
.
When I enter to "http://localhost:8001/api/v1/namespaces/default/pods/website/proxy/"
, I see the following error:
Error: 'dial tcp 172.17.0.6:5000: connect: connection refused'
Trying to reach: 'http://172.17.0.6:5000/'
*172.17.0.6 is the POD ip address.
This is the website POD yaml:
apiVersion: v1
kind: Pod
metadata:
name: website
labels:
app: website
spec:
containers:
- name: website
image: website_k8s:latest
ports:
- containerPort: 5000
- containerPort: 80
This is the dockerfile of website_k8s:latest:
FROM php:7.0-apache
RUN echo "ServerName 0.0.0.0" >> /etc/apache2/apache2.conf
COPY ./index.php /var/www/html/
EXPOSE 5000
I also tried to run service:
apiVersion: v1
kind: Service
metadata:
name: website-service
spec:
ports:
- port: 5000
targetPort: 80
protocol: TCP
name: serving
- port: 80
targetPort: 9200
protocol: TCP
name: readfromelasticsearch
selector:
app: website
And when I enter to http://localhost:8001/api/v1/namespaces/default/services/website-service/proxy/
, I see:
"kind": "Status",
"apiVersion": "v1",
"metadata":
,
"status": "Failure",
"message": "no endpoints available for service "website-service"",
"reason": "ServiceUnavailable",
"code": 503
Even though, when I run $kubectl get endpoints website-service
, I see:
NAME ENDPOINTS AGE
website-service 172.17.0.6:80,172.17.0.6:9200 59m
I see the service's POD endpoint.
How could I access my website via proxy?
apache docker kubernetes
add a comment |
I have PHP app+Apache on a Kubernetes POD. The PHP app, access Elasticsearch API on port 9200, and show a simple website, to the users, on port 5000.
I run proxy, using kubectl proxy --address='0.0.0.0' --port=8001 --accept-hosts='.*'
.
When I enter to "http://localhost:8001/api/v1/namespaces/default/pods/website/proxy/"
, I see the following error:
Error: 'dial tcp 172.17.0.6:5000: connect: connection refused'
Trying to reach: 'http://172.17.0.6:5000/'
*172.17.0.6 is the POD ip address.
This is the website POD yaml:
apiVersion: v1
kind: Pod
metadata:
name: website
labels:
app: website
spec:
containers:
- name: website
image: website_k8s:latest
ports:
- containerPort: 5000
- containerPort: 80
This is the dockerfile of website_k8s:latest:
FROM php:7.0-apache
RUN echo "ServerName 0.0.0.0" >> /etc/apache2/apache2.conf
COPY ./index.php /var/www/html/
EXPOSE 5000
I also tried to run service:
apiVersion: v1
kind: Service
metadata:
name: website-service
spec:
ports:
- port: 5000
targetPort: 80
protocol: TCP
name: serving
- port: 80
targetPort: 9200
protocol: TCP
name: readfromelasticsearch
selector:
app: website
And when I enter to http://localhost:8001/api/v1/namespaces/default/services/website-service/proxy/
, I see:
"kind": "Status",
"apiVersion": "v1",
"metadata":
,
"status": "Failure",
"message": "no endpoints available for service "website-service"",
"reason": "ServiceUnavailable",
"code": 503
Even though, when I run $kubectl get endpoints website-service
, I see:
NAME ENDPOINTS AGE
website-service 172.17.0.6:80,172.17.0.6:9200 59m
I see the service's POD endpoint.
How could I access my website via proxy?
apache docker kubernetes
add a comment |
I have PHP app+Apache on a Kubernetes POD. The PHP app, access Elasticsearch API on port 9200, and show a simple website, to the users, on port 5000.
I run proxy, using kubectl proxy --address='0.0.0.0' --port=8001 --accept-hosts='.*'
.
When I enter to "http://localhost:8001/api/v1/namespaces/default/pods/website/proxy/"
, I see the following error:
Error: 'dial tcp 172.17.0.6:5000: connect: connection refused'
Trying to reach: 'http://172.17.0.6:5000/'
*172.17.0.6 is the POD ip address.
This is the website POD yaml:
apiVersion: v1
kind: Pod
metadata:
name: website
labels:
app: website
spec:
containers:
- name: website
image: website_k8s:latest
ports:
- containerPort: 5000
- containerPort: 80
This is the dockerfile of website_k8s:latest:
FROM php:7.0-apache
RUN echo "ServerName 0.0.0.0" >> /etc/apache2/apache2.conf
COPY ./index.php /var/www/html/
EXPOSE 5000
I also tried to run service:
apiVersion: v1
kind: Service
metadata:
name: website-service
spec:
ports:
- port: 5000
targetPort: 80
protocol: TCP
name: serving
- port: 80
targetPort: 9200
protocol: TCP
name: readfromelasticsearch
selector:
app: website
And when I enter to http://localhost:8001/api/v1/namespaces/default/services/website-service/proxy/
, I see:
"kind": "Status",
"apiVersion": "v1",
"metadata":
,
"status": "Failure",
"message": "no endpoints available for service "website-service"",
"reason": "ServiceUnavailable",
"code": 503
Even though, when I run $kubectl get endpoints website-service
, I see:
NAME ENDPOINTS AGE
website-service 172.17.0.6:80,172.17.0.6:9200 59m
I see the service's POD endpoint.
How could I access my website via proxy?
apache docker kubernetes
I have PHP app+Apache on a Kubernetes POD. The PHP app, access Elasticsearch API on port 9200, and show a simple website, to the users, on port 5000.
I run proxy, using kubectl proxy --address='0.0.0.0' --port=8001 --accept-hosts='.*'
.
When I enter to "http://localhost:8001/api/v1/namespaces/default/pods/website/proxy/"
, I see the following error:
Error: 'dial tcp 172.17.0.6:5000: connect: connection refused'
Trying to reach: 'http://172.17.0.6:5000/'
*172.17.0.6 is the POD ip address.
This is the website POD yaml:
apiVersion: v1
kind: Pod
metadata:
name: website
labels:
app: website
spec:
containers:
- name: website
image: website_k8s:latest
ports:
- containerPort: 5000
- containerPort: 80
This is the dockerfile of website_k8s:latest:
FROM php:7.0-apache
RUN echo "ServerName 0.0.0.0" >> /etc/apache2/apache2.conf
COPY ./index.php /var/www/html/
EXPOSE 5000
I also tried to run service:
apiVersion: v1
kind: Service
metadata:
name: website-service
spec:
ports:
- port: 5000
targetPort: 80
protocol: TCP
name: serving
- port: 80
targetPort: 9200
protocol: TCP
name: readfromelasticsearch
selector:
app: website
And when I enter to http://localhost:8001/api/v1/namespaces/default/services/website-service/proxy/
, I see:
"kind": "Status",
"apiVersion": "v1",
"metadata":
,
"status": "Failure",
"message": "no endpoints available for service "website-service"",
"reason": "ServiceUnavailable",
"code": 503
Even though, when I run $kubectl get endpoints website-service
, I see:
NAME ENDPOINTS AGE
website-service 172.17.0.6:80,172.17.0.6:9200 59m
I see the service's POD endpoint.
How could I access my website via proxy?
apache docker kubernetes
apache docker kubernetes
edited Mar 9 at 20:10
aronot
asked Mar 8 at 17:23
aronotaronot
507
507
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The problem is that Apache is listening on port 80, not 5000.
If you remove containerPort: 5000
then you can access the website via http://localhost:8001/api/v1/namespaces/default/pods/website/proxy/
.
Secondly, the endpoints you see for the service are internal to the cluster.
So, you can access the service through those IP endpoints from within a pod: kubectl exec website -- curl 172.17.0.6/
.
If you want to expose your service externally, the service should be of type NodePort
or LoadBalancer
.
Finally, the problem you have when querying the service through the proxy is that, when you give a name to a port, you have to include it in the proxy call: curl localhost:8001/api/v1/namespaces/default/services/website-service:serving/proxy/
.
add a comment |
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55068115%2fkubernetes-unable-to-access-apache-pod-from-proxy%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem is that Apache is listening on port 80, not 5000.
If you remove containerPort: 5000
then you can access the website via http://localhost:8001/api/v1/namespaces/default/pods/website/proxy/
.
Secondly, the endpoints you see for the service are internal to the cluster.
So, you can access the service through those IP endpoints from within a pod: kubectl exec website -- curl 172.17.0.6/
.
If you want to expose your service externally, the service should be of type NodePort
or LoadBalancer
.
Finally, the problem you have when querying the service through the proxy is that, when you give a name to a port, you have to include it in the proxy call: curl localhost:8001/api/v1/namespaces/default/services/website-service:serving/proxy/
.
add a comment |
The problem is that Apache is listening on port 80, not 5000.
If you remove containerPort: 5000
then you can access the website via http://localhost:8001/api/v1/namespaces/default/pods/website/proxy/
.
Secondly, the endpoints you see for the service are internal to the cluster.
So, you can access the service through those IP endpoints from within a pod: kubectl exec website -- curl 172.17.0.6/
.
If you want to expose your service externally, the service should be of type NodePort
or LoadBalancer
.
Finally, the problem you have when querying the service through the proxy is that, when you give a name to a port, you have to include it in the proxy call: curl localhost:8001/api/v1/namespaces/default/services/website-service:serving/proxy/
.
add a comment |
The problem is that Apache is listening on port 80, not 5000.
If you remove containerPort: 5000
then you can access the website via http://localhost:8001/api/v1/namespaces/default/pods/website/proxy/
.
Secondly, the endpoints you see for the service are internal to the cluster.
So, you can access the service through those IP endpoints from within a pod: kubectl exec website -- curl 172.17.0.6/
.
If you want to expose your service externally, the service should be of type NodePort
or LoadBalancer
.
Finally, the problem you have when querying the service through the proxy is that, when you give a name to a port, you have to include it in the proxy call: curl localhost:8001/api/v1/namespaces/default/services/website-service:serving/proxy/
.
The problem is that Apache is listening on port 80, not 5000.
If you remove containerPort: 5000
then you can access the website via http://localhost:8001/api/v1/namespaces/default/pods/website/proxy/
.
Secondly, the endpoints you see for the service are internal to the cluster.
So, you can access the service through those IP endpoints from within a pod: kubectl exec website -- curl 172.17.0.6/
.
If you want to expose your service externally, the service should be of type NodePort
or LoadBalancer
.
Finally, the problem you have when querying the service through the proxy is that, when you give a name to a port, you have to include it in the proxy call: curl localhost:8001/api/v1/namespaces/default/services/website-service:serving/proxy/
.
answered Mar 9 at 0:25
metaphorimetaphori
1,52311127
1,52311127
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55068115%2fkubernetes-unable-to-access-apache-pod-from-proxy%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown