-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
connecting to the kubernetes service using curl cmd #8191
Comments
If you use the docker driver on a VM platform (like Mac or Win), you need to tunnel the ports. |
hi @afbjorklund |
See https://minikube.sigs.k8s.io/docs/start/ under "Deploy applications" |
i have exposed but even though i can access. |
kubectl describe service smef Name: smef while using endpoint ip i cant access |
NodePort only works on Linux, when using the Docker driver |
hi @afbjorklund |
ah, ok. Then the IP should be readily available, for instance through your port 30871 above. You just seemed to have picked the wrong port, i.e. target port 8080 rather than node port 30491 so something like http://172.18.0.6:30491/ should have worked to access it, sorry about the noise If you report your minikube version and OS next time, there will be less chance for such confusion |
hi @afbjorklund |
There is nothing special when using the "none" driver, maybe that the VM might be missing a browser. |
minikube start --driver=docker --force
kubectl apply -f kubedemo.yaml
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
pod/smef-567b56d6ff-lcjnk 1/1 Running 0 34m 172.18.0.6 minikube
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
service/kubernetes ClusterIP 10.96.0.1 443/TCP 68m
service/smef NodePort 10.110.128.125 8080:30491/TCP 34m app=smef
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
deployment.apps/smef 1/1 1 1 34m smef gcr.io/google-samples/node-hello:1.0 app=smef
NAME DESIRED CURRENT READY AGE CONTAINERS IMAGES SELECTOR
replicaset.apps/smef-567b56d6ff 1 1 1 34m smef gcr.io/google-samples/node-hello:1.0 app=smef,pod-template-hash=567b56d6ff
kubectl describe services
Name: smef
Namespace: default
Labels:
Annotations: Selector: app=smef
Type: NodePort
IP: 10.110.128.125
Port: 8080/TCP
TargetPort: 8080/TCP
NodePort: 30491/TCP
Endpoints: 172.18.0.6:8080
Session Affinity: None
External Traffic Policy: Cluster
Events:
root@vasanth:/home/vasanth/Desktop/k8's# curl 172.18.0.6:8080
curl: (7) Failed to connect to 172.18.0.6 port 8080: No route to host
i cant even acces this from the internet
This is my yaml file
apiVersion: apps/v1
kind: Deployment
metadata:
name: smef
labels:
app: smef
spec:
replicas: 1
selector:
matchLabels:
app: smef
template:
metadata:
labels:
app: smef
spec:
#volumes:
# - name: storage
# persistentVolumeClaim:
# claimName: creating-claim
containers:
- name: smef
image: gcr.io/google-samples/node-hello:1.0
ports:
- containerPort: 8080
name: smef
# volumeMounts:
#- mountPath: "/vasanth/data echo > hi"
# name: storage
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
apiVersion: v1
kind: Service
metadata:
name: smef
spec:
type: NodePort
ports:
selector:
app: smef
how can i acces this service
The text was updated successfully, but these errors were encountered: