148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}
Chapter 7 ■ Using ServicesDescribe the service:./kubectl describe svc hello-worldThe service description includes the service type as ClusterIP and three endpoints for the service, asshown in Figure 7-6.Figure 7-6. Describing the hello-world serviceThe service may be accessed at the clusterIP and each of the service endpoints. First, access thecluster IP with the command curl cluster-ip. The cluster-ip is 10.3.0.234, so access the service at curl10.3.0.234. The HTML markup for the service is output as shown in Figure 7-7.Figure 7-7. Invoking a service endpoint with curl157
Chapter 7 ■ Using ServicesSimilarly, invoke the service at a service endpoint 10.2.12.7 as shown in Figure 7-8. The HTML markupfor the service is output.Figure 7-8. Invoking a different service endpointTo invoke the service in a web browser, set port forwarding from a local machine. First, copy the keypairused to access the cluster controller instance to the local machine:scp -i docker.pem ec2-user@ec2-107-23-131-161.compute-1.amazonaws.com:~/kubernetes-coreos.pem ~/kubernetes-coreos.pemThen set port forwarding from the local machine locahost:80 to the cluster IP of the service on thecontroller instance:ssh -i kubernetes-coreos.pem -f -nNT -L 80:10.3.0.234:80 core@ec2-52-203-239-87.compute-1.amazonaws.comPort forwarding from local machine localhost:80 to cluster-ip:80 is set. Invoke the service in a webbrowser at http://localhost, as shown in Figure 7-9.158
- Page 121 and 122: Chapter 4 ■ Using Multiple ZonesF
- Page 123 and 124: Chapter 4 ■ Using Multiple ZonesL
- Page 125 and 126: Chapter 4 ■ Using Multiple ZonesF
- Page 127 and 128: Chapter 4 ■ Using Multiple ZonesI
- Page 129 and 130: Chapter 4 ■ Using Multiple ZonesC
- Page 131 and 132: Chapter 4 ■ Using Multiple ZonesA
- Page 133 and 134: Chapter 5 ■ Using the Tectonic Co
- Page 135 and 136: Chapter 5 ■ Using the Tectonic Co
- Page 137 and 138: Chapter 5 ■ Using the Tectonic Co
- Page 139 and 140: Chapter 5 ■ Using the Tectonic Co
- Page 141 and 142: Chapter 5 ■ Using the Tectonic Co
- Page 143 and 144: Chapter 5 ■ Using the Tectonic Co
- Page 145 and 146: Chapter 5 ■ Using the Tectonic Co
- Page 147 and 148: Chapter 5 ■ Using the Tectonic Co
- Page 149 and 150: Chapter 5 ■ Using the Tectonic Co
- Page 151 and 152: Chapter 6 ■ Using VolumesPodDocke
- Page 153 and 154: Chapter 6 ■ Using VolumesObtain t
- Page 155 and 156: Chapter 6 ■ Using VolumesFigure 6
- Page 157 and 158: Chapter 6 ■ Using VolumesThe prec
- Page 159 and 160: Chapter 6 ■ Using VolumesFigure 6
- Page 161 and 162: Chapter 6 ■ Using VolumesFigure 6
- Page 163 and 164: Chapter 6 ■ Using VolumesThe kube
- Page 165 and 166: Chapter 6 ■ Using Volumesvolumes:
- Page 167 and 168: Chapter 6 ■ Using VolumesChange d
- Page 169 and 170: Chapter 7 ■ Using ServicesAnother
- Page 171: Chapter 7 ■ Using ServicesCreatin
- Page 175 and 176: Chapter 7 ■ Using ServicesList th
- Page 177 and 178: Chapter 7 ■ Using ServicesFigure
- Page 179 and 180: Chapter 7 ■ Using ServicesInvoke
- Page 181 and 182: Chapter 7 ■ Using ServicesFigure
- Page 183 and 184: Chapter 7 ■ Using ServicesFigure
- Page 185 and 186: Chapter 7 ■ Using ServicesIn addi
- Page 187 and 188: Chapter 8 ■ Using Rolling Updates
- Page 189 and 190: Chapter 8 ■ Using Rolling Updates
- Page 191 and 192: Chapter 8 ■ Using Rolling Updates
- Page 193 and 194: Chapter 8 ■ Using Rolling Updates
- Page 195 and 196: Chapter 8 ■ Using Rolling Updates
- Page 197 and 198: Chapter 8 ■ Using Rolling Updates
- Page 199 and 200: Chapter 8 ■ Using Rolling Updates
- Page 201 and 202: Chapter 8 ■ Using Rolling Updates
- Page 203 and 204: Chapter 8 ■ Using Rolling Updates
- Page 205 and 206: Chapter 8 ■ Using Rolling Updates
- Page 207 and 208: Chapter 8 ■ Using Rolling Updates
- Page 209 and 210: Chapter 8 ■ Using Rolling Updates
- Page 211 and 212: Chapter 8 ■ Using Rolling Updates
- Page 213 and 214: Chapter 8 ■ Using Rolling Updates
- Page 215 and 216: Chapter 9 ■ Scheduling Pods on No
- Page 217 and 218: Chapter 9 ■ Scheduling Pods on No
- Page 219 and 220: Chapter 9 ■ Scheduling Pods on No
- Page 221 and 222: Chapter 9 ■ Scheduling Pods on No
Chapter 7 ■ Using Services
Describe the service:
./kubectl describe svc hello-world
The service description includes the service type as ClusterIP and three endpoints for the service, as
shown in Figure 7-6.
Figure 7-6. Describing the hello-world service
The service may be accessed at the clusterIP and each of the service endpoints. First, access the
cluster IP with the command curl cluster-ip. The cluster-ip is 10.3.0.234, so access the service at curl
10.3.0.234. The HTML markup for the service is output as shown in Figure 7-7.
Figure 7-7. Invoking a service endpoint with curl
157