Skip to content

Noobaa on Kubernetes Hands On

nb-ohad edited this page Apr 14, 2019 · 6 revisions
  1. Start minikube:
minikube start
  1. Work with minikube's internal docker - useful for development so you don't need to constantly push\pull images
eval $(minikube docker-env)
# test by listing images - you'll see all kind of k8s images
docker images
  1. build noobaa server image - first download rpm from jenkins and copy to noobaa.rpm under noobaa-core, then run docker build
docker build -f ./src/deploy/NVA_build/Server.Dockerfile -t nbserver --rm --no-cache ./
  1. tag the image
docker tag nbserver nbserver:1
  1. update noobaa_core.yaml to point to the image we just built
image: nbserver:1
  1. deploy noobaa yaml file in kubernetes
kubectl apply -f src/deploy/NVA_build/noobaa_core.yaml
  1. check that statefulset\service\pods are created
kubectl get statefulset
kubectl get pod
kubectl get service
  1. getting into the noobaa server
kubectl exec -it noobaa-server-0 /bin/bash
  1. connecting to the system from outside the cluster can be done by connecting to the service ip and the mapped port (can be found with kubectl get service)
    another option is to forward ports 80 and 8080 from kuberentes to local host
sudo kubectl port-forward noobaa-server-0 80:80 8080:8080
  1. creating agents - copy agents yaml from the UI to a file and use kubectl apply -f [agents.yaml]

Noobaa Operator

  1. build the operator. you must have go and dep installed. this will build a noobaa-operator image
./src/deploy/build_operator.sh
  1. tag the operator image
docker tag noobaa-operator noobaa-operator:1
  1. deploy the operator yaml in the cluster
kubectl create -f ./gocode/src/noobaa-operator/deploy/noobaa-operator.yaml
  1. deploy a noobaa resource in kuberentes
kubectl create -f src/deploy/NVA_build/noobaa.yaml
  1. another way to run the operator (mainly during the development of the operator itself) is locally on the laptop, instead of building an image and deploying to kubernetes
operator-sdk up local --namespace=default

AWS-CLI

You can use aws-cli easily from another pod using the service internal dns name: <service>.<namespace>.svc.cluster.local which is in minikube case noobaa-services.default.svc.cluster.local.

For example you could run the following:

kubectl run aws-cli -it --rm \
  --generator=run-pod/v1 \
  --image=mesosphere/aws-cli \
  --env="AWS_ACCESS_KEY_ID=123" \
  --env="AWS_SECRET_ACCESS_KEY=abc" \
  -- --endpoint-url http://noobaa-services.default.svc.cluster.local \
  s3api list-buckets
Clone this wiki locally