fix: fix services names (#49)

This commit is contained in:
Rémy-Christophe Schermesser 2019-05-23 14:11:41 +02:00 committed by GitHub
parent 13dc122c47
commit e8470e9d4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -137,7 +137,7 @@ Change again the number of replicas to `2`, reapply, see what is happening.
We know how to scale up/down a deployment, but how can we deploy a new version of the application. To achieve this, we need to tell Kubernetes to update the image we are using in our `deployment`, for this: We know how to scale up/down a deployment, but how can we deploy a new version of the application. To achieve this, we need to tell Kubernetes to update the image we are using in our `deployment`, for this:
```sh ```sh
$ kubectl set image deployment/simple-deployment simple-service=mhausenblas/simpleservice:0.5.0 $ kubectl set image deployment/simple-deployment simple-pod=mhausenblas/simpleservice:0.5.0
deployment.apps "simple-deployment" image updated deployment.apps "simple-deployment" image updated
``` ```

View File

@ -2,7 +2,7 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: simple-service name: simple-internal-service
spec: spec:
ports: ports:
- port: 80 - port: 80

View File

@ -7,5 +7,5 @@ metadata:
nginx.ingress.kubernetes.io/ssl-redirect: "false" nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec: spec:
backend: backend:
serviceName: simple-service serviceName: simple-internal-service
servicePort: 80 servicePort: 80

View File

@ -86,22 +86,22 @@ is central to Kubernetes. It is with those fields that you will tell Kubernetes
Apply the service: Apply the service:
```sh ```sh
$ kubectl apply -f 08-service/03-simple-service.yml $ kubectl apply -f 08-service/03-simple-internal-service.yml
service "simple-service" created service "simple-service" created
``` ```
Your service is now accessible internally, try this in your `bash` container: Your service is now accessible internally, try this in your `bash` container:
```sh ```sh
root@bash:/# nslookup simple-service root@bash:/# nslookup simple-internal-service
Server: 10.96.0.10 Server: 10.96.0.10
Address: 10.96.0.10#53 Address: 10.96.0.10#53
Name: simple-service.default.svc.cluster.local Name: simple-internal-service.default.svc.cluster.local
Address: 10.96.31.244 Address: 10.96.31.244
``` ```
Try to curl the `/info` url, remember the `ports` we choose in the `service`. Try to curl the `/healthz` url, remember the `ports` we choose in the `service`.
Can you access this service from the outside of Kubernetes? Can you access this service from the outside of Kubernetes?
@ -130,7 +130,7 @@ metadata:
nginx.ingress.kubernetes.io/ssl-redirect: "false" nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec: spec:
backend: backend:
serviceName: simple-service serviceName: simple-internal-service
servicePort: 80 servicePort: 80
``` ```