0
votes

I'm trying to inject istio into my kubernetes in minikube environment on my local ubuntu 16.04 system. this is my deployment yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nodejs-master
  labels:
    run: nodejs-master
spec:
  replicas: 1
  template:
    metadata:
      labels:
        run: nodejs-master
    spec:
      containers:
      - name: nodejs-master
        image: hegdemahendra9/nodejs-master:v1
        ports:
        - containerPort: 8080
          protocol: TCP
---
kind: Service
apiVersion: v1
metadata:
  name: nodejs-master
spec:
  selector:
    run: nodejs-master
  ports:
    - name: port1
      protocol: TCP
      port: 8080
      targetPort: 8080
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nodejs-slave
  labels:
    run: nodejs-slave
spec:
  replicas: 1
  template:
    metadata:
      labels:
        run: nodejs-slave
    spec:
      containers:
      - name: nodejs-slave
        image: hegdemahendra9/nodejs-slave:v1
        ports:
        - containerPort: 8081
          protocol: TCP
---
kind: Service
apiVersion: v1
metadata:
  name: nodejs-slave
spec:
  selector:
    run: nodejs-slave
  ports:
    - name: port1
      protocol: TCP
      port: 8081
      targetPort: 8081
  type: NodePort

I've enabled automatic sidecar injection and ran $kubect apply -f deployment.yaml

I've installed istio via this method here's my istio installation details :

$ kubectl get pods -n istio-system
NAME                                      READY   STATUS      RESTARTS   AGE
istio-citadel-6d7f9c545b-r665q            1/1     Running     0          2h
istio-cleanup-secrets-qg4zh               0/1     Completed   0          2h
istio-egressgateway-866885bb49-9l5rx      1/1     Running     0          2h
istio-galley-6d74549bb9-jslss             1/1     Running     0          2h
istio-ingressgateway-6c6ffb7dc8-rzvxb     1/1     Running     0          2h
istio-pilot-685fc95d96-6296x              0/2     Pending     0          2h
istio-policy-688f99c9c4-trg2j             2/2     Running     0          2h
istio-security-post-install-gs6vk         0/1     Completed   0          2h
istio-sidecar-injector-74855c54b9-j94qr   1/1     Running     0          2h
istio-telemetry-69b794ff59-rqbzw          2/2     Running     0          2h
prometheus-f556886b8-kj5ks                1/1     Running     0          2h


$ kubectl get svc -n istio-system
NAME                     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                                                                                                                   AGE
istio-citadel            ClusterIP   10.108.144.211   <none>        8060/TCP,9093/TCP                                                                                                         2h
istio-egressgateway      NodePort    10.99.160.138    <none>        80:32415/TCP,443:32480/TCP                                                                                                2h
istio-galley             ClusterIP   10.97.0.188      <none>        443/TCP,9093/TCP                                                                                                          2h
istio-ingressgateway     NodePort    10.97.75.20      <none>        80:31380/TCP,443:31390/TCP,31400:31400/TCP,15011:32188/TCP,8060:31372/TCP,853:31197/TCP,15030:30606/TCP,15031:31026/TCP   2h
istio-pilot              ClusterIP   10.106.145.225   <none>        15010/TCP,15011/TCP,8080/TCP,9093/TCP                                                                                     2h
istio-policy             ClusterIP   10.110.104.100   <none>        9091/TCP,15004/TCP,9093/TCP                                                                                               2h
istio-sidecar-injector   ClusterIP   10.99.236.121    <none>        443/TCP                                                                                                                   2h
istio-telemetry          ClusterIP   10.103.92.170    <none>        9091/TCP,15004/TCP,9093/TCP,42422/TCP                                                                                     2h
prometheus               ClusterIP   10.105.31.126    <none>        9090/TCP      

here's my deployment details

$kubectl get pods
NAME                                   READY   STATUS    RESTARTS   AGE
nodejs-master-6494d9dd66-pdbd6         2/2     Running   0          2h
nodejs-slave-599cd5d676-6w4s8          2/2     Running   0          2h

$ kubectl get svc
NAME            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
kubernetes      ClusterIP   10.96.0.1        <none>        443/TCP          1d
nodejs-master   ClusterIP   10.104.99.240    <none>        8080/TCP         2h
nodejs-slave    NodePort    10.101.120.229   <none>        8081:31263/TCP   2h

Here's my gateway yaml

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: ms-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: mater-slave
spec:
  hosts:
  - "*"
  gateways:
  - ms-gateway
  http:
  - match:
    - uri:
        prefix: /master
    route:
    - destination:
        host: nodejs-master
        port:
          number: 8080

I've applied my gateway using kubectl apply command. and trying to access it using

http://($minikube ip):kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}'/master

i.e http://192.168.99.100:31380/master

but I'm getting connection refused error. Someone please help.

thanks in advance.

1
Possible duplicate of Unable to setup Istio with minikubeNick_Kh
Question edited. please take a look.mahendra

1 Answers

0
votes

Maybe it's the name of the service port. It should be "tcp-*". https://istio.io/docs/setup/kubernetes/additional-setup/requirements/