Back to Top

New to Kubepack? Please start here.

Using Kubepack as an App User

 How To Use

If you want to use others application with pack, then follow below instruction:

  1. Create a git repository.
  2. Create manifest.yaml file in the repository. See manifest.yaml doc
  3. Add all the dependencies under dependencies in manifest.yaml file.
  4. Run pack dep -v 10 to get all the dependencies in _vendor folder.
  5. Run pack edit -s <filepath>, if you want to change some file from _vendor folder. This command will generate a patch under patch folder. _vendor will be unchanged.
  6. Run pack up to combine patch and _vendor folder files. And final combination will be under _outlook folder.
  7. Now, all is need to do kubectl apply -R -f _outlook/. Then, your desired application will be deployed in kubernetes cluster.

 Example

In this example, you’ll see how to deploy AppsCode kubed in minikube using Pack.

In this example, we’re using this test-case.

Below command show the manifest.yaml file.

$ cat manifest.yaml
package: github.com/kubepack/kubepack/docs/_testdata/test-7/manifest.yaml
owners:
- name: Appscode
  email: team@appscode.com
dependencies:
- package: github.com/kubepack/test-kubed
  branch: master

manifest.yaml file contain test-kubed as dependencies. test-kubed contains all the necessary yaml file needs to deploy kubed in minikube cluster.

Now, pack dep command will pull all the dependencies and place it in _vendor folder. If test-kubed repository also depend on some other repository then pack will get that too.

  $ pack dep
  $ tree _vendor/
  _vendor/
  └── github.com
      └── kubepack
          └── test-kubed
              ├── deployment.yaml
              ├── kubed-config.yaml
              ├── manifest.yaml
              └── service.yaml

  3 directories, 4 files

Now, all the dependencies in place. Now, we can edit _vendor and this will generate patch.

We’re want to change kubed-config.yaml file, which is a secret yaml file.

    $ cat _vendor/github.com/kubepack/test-kubed/kubed-config.yaml
    apiVersion: v1
    data:
      config.yaml: YXBpU2VydmVyOgogIGFkZHJlc3M6IDo4MDgwCiAgZW5hYmxlUmV2ZXJzZUluZGV4OiB0cnVlCiAgZW5hYmxlU2VhcmNoSW5kZXg6IHRydWUKY2x1c3Rlck5hbWU6IHVuaWNvcm4KZW5hYmxlQ29uZmlnU3luY2VyOiB0cnVlCmV2ZW50Rm9yd2FyZGVyOgogIGNzckV2ZW50czoKICAgIGhhbmRsZTogZmFsc2UKIC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NyZXROYW1lOiBzbmFwLXNlY3JldAo=
    kind: Secret
    metadata:
      creationTimestamp: null
      labels:
        app: kubed
      name: kubed-config
      namespace: kube-system

We’ll change config.yaml under data field. config.yaml value will be YXBpU2VydmVyOgogIGFkZHJlc3M6IDo4MDgwCiAgZW5hYmxlUmV2ZXJzZUluZGV4OiB0cnVlCiAgZW5hYmxlU2VhcmNoSW5kZXg6IHRydWUKY2x1c3Rlck5hbWU6IHVuaWNvcm4KZW5hYmxlQ29uZmlnU3luY2VyOiB0cnVlCg==

$ pack edit -s _vendor/github.com/kubepack/test-kubed/kubed-config.yaml

Above command will open file in editor. Then, change config.yaml to above value. This will generate a patch in patch folder.

Below $ pack up command will combine patch and _vendor folder files and dump in _outlook folder.

 $ pack up
 $ kubectl apply -R -f _outlook/

$ kubectl apply -R -f _outlook/ command will deploy kubed in minikube cluster.

 Next Steps

  • Take a look at how Kubepack handles various scenarios here.
  • Want to publish apps using Kubepack? Please visit here.
  • To learn about manifest.yaml file, please visit here.
  • Learn more about pack cli from here.

Subscribe to our free technical newsletter!

Join thousands of subscribers and stay up-to-date on AppsCode.