Install and setup cloud foundry in kubernetes cluster
First prepare the tools installation in host:
- Kind: https://kind.sigs.k8s.io/docs/user/quick-start/
- Cf command: https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
HOMEBREW_NO_AUTO_UPDATE=1 brew install cloudfoundry/tap/cf-cli@6
orHOMEBREW_NO_AUTO_UPDATE=1 brew install cloudfoundry/tap/cf-cli@7
- Kubectl command: https://kubernetes.io/docs/tasks/tools/install-kubectl/
- Helm: https://helm.sh/docs/intro/install/
The Kind must definiation config.yml, refer to expose http(80) and https(443) ports to host machine, because the k8s cluster node ip is internal-ip created by Kind such as: 172.18.0.2
1kind: Cluster
2apiVersion: kind.x-k8s.io/v1alpha4
3networking:
4 # WARNING: It is _strongly_ recommended that you keep this the default
5 # (127.0.0.1) for security reasons. However it is possible to change this.
6 apiServerAddress: "Host external ip"
7 # This can connect to k8s from external when install kind in virtual host or cloud platform(ec2 of aws)
8 # By default the API server listens on a random open port.
9 # You may choose a specific port but probably don't need to in most cases.
10 # Using a random port makes it easier to spin up multiple clusters.
11 apiServerPort: 6443
12nodes:
13- role: control-plane
14 # port forward 80 on the host to 80 on this node
15 extraPortMappings:
16 - containerPort: 80
17 hostPort: 80
18 # optional: set the bind address on the host
19 # 0.0.0.0 is the current default
20 listenAddress: "0.0.0.0"
21 # optional: set the protocol to one of TCP, UDP, SCTP.
22 # TCP is the default
23 protocol: TCP
24 - containerPort: 443
25 hostPort: 443
26 listenAddress: "0.0.0.0"
27 protocol: TCP
execute command create cluster:
kind create cluster --name kubecf --config kind.yaml
In order to https://kubecf.suse.dev/docs/tutorials/deploy-kind/ tutorial. setup environment. But need to change something configuration and verstion. Use newest version for cf-operator and kubecf, through this repo url view release detail:
- cf-operator: https://github.com/cloudfoundry-incubator/quarks-operator/releases
- kubecf: https://github.com/cloudfoundry-incubator/kubecf/releases
The helm install look likes following:
1 helm install cf-operator \
2 --namespace cfo \
3 --set "global.singleNamespace.name=kubecf" \
4 https://cf-operators.s3.amazonaws.com/helm-charts/cf-operator-5.0.0%2B0.gd7ac12bc.tgz
5
6 helm install kubecf \
7 --namespace kubecf \
8 --set "system_domain=kubecf.example.com" \
9 --set "features.eirini.enabled=true" \
10 --set "features.ingress.enabled=true" \
11 https://kubecf.s3.amazonaws.com/kubecf-v2.3.0.tgz
Add the nginx ingress component
1helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
2
3helm install ingress ingress-nginx/ingress-nginx \
4--namespace ingress \
5--set "tcp.2222=kubecf/scheduler:2222"
Change All type is loadbalance in k8s service configuration add yaml section like following:
1 externalIPs:
2 - 172.18.0.2
The node_ip can get through:
1 kubectl get node kubecf-control-plane \
2 --output jsonpath='{ .status.addresses[?(@.type == "InternalIP")].address }'
Then change ingress controller service config.
Cancel tls config: remove tls section in ingress service The backend servicePort change to : 80
- Resolves a list of domain names to Host external ip. such as: {api|login|uaa|credhub}.kubecf.example.com and other domain name can view: http://api.kubecf.example.com/ when kubecf is launched
Test cf login: cf login --skip-ssl-validation -a https://api.kubecf.example.com -u admin