I'm new to Kubernetes and Rancher. I have builde node docker image with below commands:
FROM node:10
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app
RUN npm cache clean
RUN npm install
COPY . /usr/src/app
EXPOSE 3000
CMD ["npm","start"]
I have put docker image to my repo on docker hub. From Docker hub I'm pulling same image on Rancher/Kubernetes its showing as it as in Active state, as shown below:
kubectl get svc -n nodejs
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
node-front-end ClusterIP 10.43.14.96 <none> 49160/TCP 21m
node-front-end-nodeport NodePort 10.43.171.52 <none> 49160:31366/TCP 21m
But when I'm trying with above IP and Port it's giving message : "This site can’t be reached"
So i'm not able to understand what I'm doing wrong here.
Please guide.
But when I'm trying with above IP and Port it's giving message : "This site can’t be reached"
Correct, those ClusterIP
s are "virtual," in that they exist only inside the cluster. The address you will want to use is any of the Node
's IP addresses, and then the port :31366
listed there in the Service
of type NodePort
.
Just in case you don't already know them, one can usually find the IP address of the Nodes with kubectl get -o wide nodes
.