Tips

    You have two containers in a pod

    From these images

    1. or
    2. kubectl get pods -o jsonpath="{.items[*].spec.containers[*].image}" -l app=customer -n tutorial

    Get the pod ids

    1. CPOD=$(oc get pods -o jsonpath='{.items[*].metadata.name}' -l app=customer -n tutorial)
    2. PPOD=$(oc get pods -o jsonpath='{.items[*].metadata.name}' -l app=preference -n tutorial)
    3. RPOD1=$(oc get pods -o jsonpath='{.items[*].metadata.name}' -l app=recommendation,version=v1 -n tutorial)
    4. RPOD2=$(oc get pods -o jsonpath='{.items[*].metadata.name}' -l app=recommendation,version=v2 -n tutorial)
    5. or
    6. CPOD=$(kubectl get pods -o jsonpath='{.items[*].metadata.name}' -l app=customer -n tutorial)
    7. PPOD=$(kubectl get pods -o jsonpath='{.items[*].metadata.name}' -l app=preference -n tutorial)
    8. RPOD1=$(kubectl get pods -o jsonpath='{.items[*].metadata.name}' -l app=recommendation,version=v1 -n tutorial)
    9. RPOD2=$(kubectl get pods -o jsonpath='{.items[*].metadata.name}' -l app=recommendation,version=v2 -n tutorial)

    The pods all see each other’s services

    1. oc exec $CPOD -c customer -n tutorial curl
    2. oc exec $CPOD -c customer -n tutorial curl http://recommendation:8080
    3. oc exec $RPOD2 -c recommendation -n tutorial curl
    4. or
    5. kubectl exec $CPOD -c customer -n tutorial curl http://preference:8080
    6. kubectl exec $CPOD -c customer -n tutorial curl
    7. kubectl exec $RPOD2 -c recommendation -n tutorial curl http://customer:8080
    1. "virtualHosts": [
    2. {
    3. "name": "customer.tutorial.svc.cluster.local:8080",
    4. "domains": [
    5. "customer.tutorial.svc.cluster.local",
    6. "customer.tutorial.svc.cluster.local:8080",
    7. "customer",
    8. "customer:8080",
    9. "customer.tutorial.svc.cluster",
    10. "customer.tutorial.svc.cluster:8080",
    11. "customer.tutorial.svc",
    12. "customer.tutorial.svc:8080",
    13. "customer.tutorial",
    14. "customer.tutorial:8080",
    15. "172.30.107.115",
    16. "172.30.107.115:8080"
    17. ],
    18. "routes": [
    19. {
    20. "match": {
    21. "prefix": "/"
    22. },
    23. "route": {
    24. "cluster": "outbound|8080||customer.tutorial.svc.cluster.local"
    25. },
    26. "decorator": {
    27. "operation": "default-route"
    28. }
    29. }
    30. ]
    31. },
    32. "name": "istio-pilot.istio-system.svc.cluster.local:8080",
    33. "domains": [
    34. "istio-pilot.istio-system.svc.cluster.local",
    35. "istio-pilot.istio-system.svc.cluster.local:8080",
    36. "istio-pilot.istio-system",
    37. "istio-pilot.istio-system:8080",
    38. "istio-pilot.istio-system.svc.cluster",
    39. "istio-pilot.istio-system.svc.cluster:8080",
    40. "istio-pilot.istio-system.svc",
    41. "istio-pilot.istio-system.svc:8080",
    42. "172.30.142.41",
    43. "172.30.142.41:8080"
    44. ],
    45. "routes": [
    46. {
    47. "match": {
    48. "prefix": "/"
    49. },
    50. "route": {
    51. "cluster": "outbound|8080||istio-pilot.istio-system.svc.cluster.local"
    52. },
    53. "decorator": {
    54. "operation": "default-route"
    55. }
    56. }
    57. ]
    58. },
    59. {
    60. "name": "preference.tutorial.svc.cluster.local:8080",
    61. "domains": [
    62. "preference.tutorial.svc.cluster.local",
    63. "preference.tutorial.svc.cluster.local:8080",
    64. "preference",
    65. "preference:8080",
    66. "preference.tutorial.svc.cluster",
    67. "preference.tutorial.svc.cluster:8080",
    68. "preference.tutorial.svc",
    69. "preference.tutorial.svc:8080",
    70. "preference.tutorial",
    71. "preference.tutorial:8080",
    72. "172.30.26.194",
    73. "172.30.26.194:8080"
    74. ],
    75. "routes": [
    76. {
    77. "match": {
    78. "prefix": "/"
    79. },
    80. "route": {
    81. "cluster": "outbound|8080||preference.tutorial.svc.cluster.local"
    82. },
    83. "decorator": {
    84. "operation": "default-route"
    85. }
    86. },
    87. {
    88. "name": "recommendation.tutorial.svc.cluster.local:8080",
    89. "domains": [
    90. "recommendation.tutorial.svc.cluster.local",
    91. "recommendation.tutorial.svc.cluster.local:8080",
    92. "recommendation",
    93. "recommendation:8080",
    94. "recommendation.tutorial.svc.cluster",
    95. "recommendation.tutorial.svc.cluster:8080",
    96. "recommendation.tutorial.svc",
    97. "recommendation.tutorial.svc:8080",
    98. "recommendation.tutorial",
    99. "recommendation.tutorial:8080",
    100. "172.30.103.127",
    101. "172.30.103.127:8080"
    102. ],
    103. "routes": [
    104. {
    105. "match": {
    106. "prefix": "/"
    107. },
    108. "route": {
    109. "cluster": "outbound|8080||recommendation.tutorial.svc.cluster.local"
    110. },
    111. "decorator": {
    112. "operation": "default-route"
    113. }
    114. }
    115. ]
    116. }
    117. ],

    Now add a new destinationrule and virtualservice.

    1. istioctl create -f
    2. istioctl create -f istiofiles/virtual-service-recommendation-v2.yml

    The review the routes again

    1. oc exec $CPOD -c customer -n tutorial curl > bfile.json
    2. or
    3. kubectl exec $CPOD -c customer -n tutorial curl http://localhost:15000/config_dump > bfile.json

    Here is the Before:

    and

    1. "decorator": {
    2. "operation": "default-route"
    3. }
    1. "route": {
    2. "cluster": "outbound|8080|version-v2|recommendation.tutorial.svc.cluster.local",
    3. },

    and

    1. "decorator": {
    2. "operation": "recommendation"
    3. }

    If you need the Pod IP

    Dive into the istio-proxy container

    1. oc exec -it $CPOD -c istio-proxy -n tutorial /bin/bash
    2. or
    3. kubectl exec -it $CPOD -c istio-proxy -n tutorial /bin/bash
    4. cd /etc/istio/proxy
    5. ls
    6. cat envoy-rev0.json

    Snowdrop Troubleshooting