Manage your SugarFunge Infrastructure in Kubernetes.
Kubernetes Version | sugarfunge-k8s version |
---|---|
1.23 | 0.1.0 (Latest) |
Check the Cargo.toml
file if you're running from main
after the first release gets published:
// feature 1_23 = Kubernetes 1.23
k8s-openapi = { version = "0.15.0", features = ["v1_23"] }`
- Check the available commands and arguments.
sugarfunge-k8s --help
- Run the infrastructure with the default configuration.
kubectl create ns test
sugarfunge-k8s create ipfs
sugarfunge-k8s create ipfs -n test
sugarfunge-k8s create node
sugarfunge-k8s create node --config=config.ron -n test
sugarfunge-k8s create explorer
sugarfunge-k8s create status
sugarfunge-k8s create api
# Check the Keycloak section on how to run it with the default configution.
sugarfunge-k8s create keycloak
- Rust: Stable
$ git clone https://github.com/SugarFunge/sugarfunge-k8s.git
$ cd sugarfunge-k8s
$ cargo build --release
# Run
$ ./target/release/sugarfunge-k8s --help
# or
$ cargo run --release -- --help
This configuration is intended for local and/or testing purposes.
- Helm: Stable
- Use helm to add the bitnami repo and install the postgres chart with the configuration file provided in the repository.
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm install sf-db bitnami/postgresql -f postgres_local.yaml
- Create the keycloak service into the Kubernetes cluster with the default configuration.
$ sugarfunge-k8s create keycloak
This feature is intended for testing purposes only.
- Install the dependencies via
kubectl
orHelm
. - Create a
ClusterIssuer
withkubectl
. An example is provided below using the staging enviroment ofLet's Encrypt
.
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-staging
spec:
acme:
server: https://acme-staging-v02.api.letsencrypt.org/directory
email: youremail@domain.com
privateKeySecretRef:
name: letsencrypt-staging
solvers:
- http01:
ingress:
class: nginx
- Be sure that your
config.ron
includes the name of theClusterIssuer
.
ingress: Some(
IngressConfig (
...
tls_issuer: "letsencrypt-staging",
)
),
- The
host
in theconfig.ron
for theIngressConfig
requires to set up subdomains. If the host isdemo.sugarfunge.dev
, it's expected to create all the subdomains that matches each servicename
in theconfig.ron
file and points to the nginx service IP address.
api.demo.sugarfunge.dev
explorer.demo.sugarfunge.dev
ipfs.demo.sugarfunge.dev
auth.demo.sugarfunge.dev
node.demo.sugarfunge.dev
status.demo.sugarfunge.dev
For example, for the keycloak
service, the config.ron
the name field for KeycloakConfig
should be auth
:
keycloak: Some(
KeycloakConfig (
name: "auth",
...
)
),
- Create the service with the cli tool and wait for the issuer to create and validate the
Let's Encrypt
certificate.
sugarfunge-k8s create ingress --config config.ron