Chapter 6. Working with Skaffold Container Image Builders and Deployers


$ cd ~/tmp/Effortless-Cloud-Native-App-Development-Using-Skaffold/Chapter06/
$ skaffold run --profile docker


$ kubectl get all
NAME                                    READY   STATUS    RESTARTS   AGE
pod/reactive-web-app-5b79d5bbd7-qltjt   1/1     Running   0          25s

NAME                       TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
service/kubernetes         ClusterIP      10.96.0.1       <none>        443/TCP          4m8s
service/reactive-web-app   LoadBalancer   10.110.214.23   <pending>     8080:32585/TCP   25s

NAME                               READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/reactive-web-app   1/1     1            1           25s

NAME                                          DESIRED   CURRENT   READY   AGE
replicaset.apps/reactive-web-app-5b79d5bbd7   1         1         1       25s


$ kubectl get svc
NAME               TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
kubernetes         ClusterIP      10.96.0.1       <none>        443/TCP          4m33s
reactive-web-app   LoadBalancer   10.110.214.23   <pending>     8080:32585/TCP   50s


// Убеждаемся, что значение профиля установлено
$ echo ${PROFILE}


Если нет


$ export \
  PROFILE=marley-minikube


$ minikube --profile ${PROFILE} service reactive-web-app
|-----------|------------------|-------------|---------------------------|
| NAMESPACE |       NAME       | TARGET PORT |            URL            |
|-----------|------------------|-------------|---------------------------|
| default   | reactive-web-app |        8080 | http://192.168.49.2:32585 |
|-----------|------------------|-------------|---------------------------|
🎉  Opening service default/reactive-web-app in default browser...
👉  http://192.168.49.2:32585


$ curl -X GET "http://192.168.49.2:32585/employee" \
  | jq


[
  {
    "id": 1,
    "firstName": "Peter",
    "lastName": "Parker",
    "age": 25,
    "salary": 20000
  },
  {
    "id": 2,
    "firstName": "Tony",
    "lastName": "Stark",
    "age": 30,
    "salary": 40000
  },
  {
    "id": 3,
    "firstName": "Clark",
    "lastName": "Kent",
    "age": 31,
    "salary": 60000
  },
  {
    "id": 4,
    "firstName": "Bruce",
    "lastName": "Wayne",
    "age": 33,
    "salary": 100000
  }
]


$ skaffold delete


Kustomize


// Проверка, что проект билдится
// Нет необходимости выполнять
$ ./mvnw package


OK!


$ vi pom.xml


Прописываю подходящую версию библиотеки jib-maven-plugin


<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>3.1.4</version>


Если протухнет, смотреть здесь:

https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin#quickstart


$ skaffold dev


Команды из примера выше для подключения работают!


$ skaffold run --profile=kustomizeBase --default-repo=gcr.io/basic-curve-316617
$ skaffold run --profile=kustomizeProd --default-repo=gcr.io/basic-curve-316617


$ skaffold delete


$ skaffold run --profile=kustomizeDev


Fail!


Helm


Установил Helm


$ skaffold run --profile=jibWithHelm
Generating tags...
 - gcr.io/basic-curve-316617/reactive-web-app-helm -> gcr.io/basic-curve-316617/reactive-web-app-helm:4c4f2c8-dirty
Checking cache...
 - gcr.io/basic-curve-316617/reactive-web-app-helm: Found Locally
Starting test...
Tags used in deployment:
 - gcr.io/basic-curve-316617/reactive-web-app-helm -> gcr.io/basic-curve-316617/reactive-web-app-helm:7b7f64704771899fb746b73432c1b2cca9d5cc2ed818246763847847b4a87122
Starting deploy...
Error: UPGRADE FAILED: YAML parse error on reactive-web-app-helm/templates/deployment.yaml: error converting YAML to JSON: yaml: line 5: did not find expected node content
deploying "reactive-web-app-helm": install: exit status 1


Fail!