Skip to content

Commit

Permalink
Merge pull request #16 from replicatedhq/diamonwiggins/how-to-install
Browse files Browse the repository at this point in the history
Kubeflare Installation with Kubectl
  • Loading branch information
diamonwiggins authored Jul 26, 2021
2 parents aaae1f0 + 607930f commit 15cb165
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 15 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ After installing the Kubeflare Operator to your Kubernetes cluster, some new cus

This project was created at [Replicated](https://www.replicated.com) to manage Cloudflare settings using our GitOps workflow. We wanted a way for a devleoper to commit their DNS records and other Cloudflare settings to be reviewed and deployed with their code, as a single deployment. This tightly couples the infrastructure changes with the application changes, and makes deploying new services easier and more transparant.

## Installation

Full instruction and all installation methods are listed in the [documentation](https://kubeflare.com).

## Examples

Below is an example of a Kubernetes manifest that we deploy for a domain (with some information redacted):
Expand Down
2 changes: 0 additions & 2 deletions docs/docs/api/zone.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,3 @@ Kubeflare uses boolean objects (true, false) and will map those to the string ty
| websockets | [websockets](https://api.cloudflare.com/#zone-settings-change-websockets-setting) | boolean
| imageResizing | [image_resizing](https://api.cloudflare.com/#zone-settings-change-image-resizing-setting) | boolean
| http2Prioritization | [h2_prioritization](https://api.cloudflare.com/#zone-settings-change-http/2-edge-prioritization-setting) | boolean


51 changes: 51 additions & 0 deletions docs/docs/getting-started/tutorial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Kubeflare Tutorial

This tutorial describes how to setup Kubeflare to manage your Cloudflare resources.

## Cloudflare Account Setup

If you don't have a Cloudflare account and site already, create one following the instructions [here] (https://support.cloudflare.com/hc/en-us/articles/201720164-Creating-a-Cloudflare-account-and-adding-a-website)

## Install

Install Kubeflare via [kubectl](/install/kubectl) or [Helm](/install/helm).

## Create a DNS Record

### Create a secret with your API Token

kubectl -n kubeflare-system create secret generic cf-api-secret --from-literal cf-api-token=<your-api-token>

### Define a Zone

```yaml
apiVersion: crds.kubeflare.io/v1alpha1
kind: Zone
metadata:
name: domainname.io
spec:
apiToken:
valueFrom:
secretKeyRef:
name: cf-api-secret
key: cf-api-token
```
Full API Documentation for Zones in Kubeflare [here] (/api/zone).
### Create an A Record
```yaml
apiVersion: crds.kubeflare.io/v1alpha1
kind: DNSRecord
metadata:
name: www.domainname.io
spec:
zone: domainname.io
record:
type: "A"
name: "www"
content: "1.1.1.1"
proxied: true
ttl: 3600
```
1 change: 1 addition & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ New to Kubeflare?
This is where you want to get started.

- Installation: Install Kubeflare via [kubectl](/install/kubectl) or [Helm](/install/helm).
- Tutorial: Learn how to create a simple A record with Kubeflare [Tutorial](/getting-started/tutorial)
- Importing: Learn how to automatically [import your existing Cloudflare zones](/getting-started/importing)

## Getting Help
Expand Down
78 changes: 65 additions & 13 deletions docs/docs/install/kubectl.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,83 @@ Kubeflare requires Kubernetes 1.16 or later to install.
To install the current version of Kubeflare:

```shell
kubectl apply -f https://git.io/kubeflare
git clone [email protected]:replicatedhq/kubeflare.git
kubectl apply -f kubeflare/config/crds/v1
cat <<EOF | kubectl apply -f -
---
apiVersion: v1
kind: Namespace
metadata:
name: kubeflare-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kubeflare
rules:
- apiGroups: ['']
resources:
- namespaces
- secrets
verbs: [get, list, watch]
- apiGroups: [crds.kubeflare.io]
resources: ['*']
verbs: [get, list, watch, update, patch, create, delete]
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kubeflare
namespace: kubeflare-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubeflare
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kubeflare
subjects:
- name: kubeflare
namespace: kubeflare-system
kind: ServiceAccount
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: kubeflare
namespace: kubeflare-system
spec:
replicas: 1
selector:
matchLabels:
app: kubeflare
template:
metadata:
labels:
app: kubeflare
spec:
serviceAccountName: kubeflare
containers:
- name: kubeflare
image: replicated/kubeflare-manager:0.2.0
imagePullPolicy: IfNotPresent
EOF
```

## Upgrading

To upgrade when there's a new release available, run the same command again:

```shell
kubectl apply -f https://git.io/kubeflare
```
To upgrade when there's a new release available, run the same commands from the install section again, but with the updated image tag.

## Uninstalling

To uninstall Kueflare completely from your cluster:

```shell
kubectl delete -f https://git.io/kubeflare
```

Or, if you need to uninstall manually:

```shell
kubectl delete crd apitokens.crds.kubeflare.io
kubectl delete crd dnsrecords.crds.kubeflare.io
kubectl delete crd tokens.crds.kubeflare.io
kubectl delete crd zones.crds.kubeflare.io
kubectl delete ns kubeflare-system
```
```

0 comments on commit 15cb165

Please sign in to comment.