# KUBERNETES@RUG ## Access Vraag een API aan via webhosting.cit@rug.nl voor toegang tot de kubernetes test omgeving. ```` cat > .kube/config < get ingress kubectl --namespace= get ingress | grep kubectl edit --namespace= ingress Adjust some values : metadata: annotations: nginx.ingress.kubernetes.io/proxy-body-size: 10m nginx.ingress.kubernetes.io/proxy-connect-timeout: "120" nginx.ingress.kubernetes.io/proxy-read-timeout: "120" nginx.ingress.kubernetes.io/proxy-send-timeout: "120" save/quit ```` ## Ingress WhiteList ```` kubectl edit ingress .... # add annotation nginx.ingress.kubernetes.io/whitelist-source-range = "1.1.1.1/24" ```` ## Ingress Basic Auth ```` htpasswd -c passfile foo kubectl create secret generic basic-auth --from-file=passfile ```` check secret ```` kubectl get secret basic-auth -o yaml ```` edit ingress ```` kubectl edit ingress example metadata: name: ingress-with-auth annotations: # type of authentication nginx.ingress.kubernetes.io/auth-type: basic # name of the secret that contains the user/password definitions nginx.ingress.kubernetes.io/auth-secret: basic-auth # message to display with an appropriate context why the authentication is required nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - foo' ```` ## Edit Deployment Steps : ```` kubectl --namespace= get deployments kubectl --namespace= get deployment | grep kubectl edit --namespace= deployments Adjust some values : hostAliases: - hostnames: - example.com ip: 127.0.0.1 save/quit ```` ## Register SSL test environment ( only with public IP ) Register SSL with letsencrypt-issuer ```` cat > nginx.yml < simple.yml < pv.yml < pvc.yml < service.yml < deploy.yml < https.yml < # Output information about a node ### pod and container kubectl get pods # List the current pods kubectl describe pod # Describe pod kubectl get rc # List the replication controllers kubectl get rc --namespace="" # List the replication controllers in kubectl describe rc # Describe replication controller kubectl get svc # List the services kubectl describe svc # Describe service ### interacting kubectl run --image= # Launch a pod called # using image kubectl create -f # Create a service described # in kubectl scale --replicas= rc # Scale replication controller # to instances kubectl expose rc --port= --target-port= # Map port to # port on replication # controller ### stopping kubectl delete pod # Delete pod kubectl delete rc # Delete replication controller kubectl delete svc # Delete service kubectl drain --delete-local-data --force --ignore-daemonsets # Stop all pods on kubectl delete node ### administration kubeadm init # Initialize your master node kubeadm join --token : # Join a node to your Kubernetes cluster kubectl create namespace # Create namespace kubectl taint nodes --all node-role.kubernetes.io/master- # Allow Kubernetes master nodes to run pods kubeadm reset # Reset current state kubectl get secrets ````