Giter Club home page Giter Club logo

kubernetes-tutorial's Introduction

Kubernetes Tutorial

badge badge badge badge

You can access the HTML version of this tutorial here: https://redhat-scholars.github.io/kubernetes-tutorial/

Visual Studio Code Remote Development

If you are using Visual Studio Code with the Remote Containers Extension, you don’t need to install anything locally to be able to contribute or run through this tutorial.

Simply follow these instructions:

  1. (Only if running with podman) Set the environment variable DEVCONTAINER_TARGET_PREFIX=podman

  2. Open VS Code from the root of the kubernetes-tutorial repository and when prompted indicate that you want to "open the folder in a container".

Once the devcontainer is initialized, from the Visual Studio Code terminal you will be able to run all the commands outlined for creating documentation.

Execute Tutorial with VSCode Remote

You can also run through the tutorial with VSCode Remote. The only trick is that you will need to be able to access minikube from within your docker container.

Building the HTML locally

In the root of your git repository, run:

bin/build-site.sh

And then open your gh-pages/index.html file:

open gh-pages/index.html

Iterative local development

You can develop the tutorial docs locally using a rapid iterative cycle.

First, install the yarn dependencies:

yarn install

And now start gulp. It will create the website and open your browser connected with browser-sync. Everytime it detects a change, it will automatically refresh your browser page.

gulp

You can clean the local cache using:

gulp clean

kubernetes-tutorial's People

Contributors

ammbra avatar burrsutter avatar cedricclyburn avatar detinsley1s avatar dev-adriano avatar hatmarch avatar joshix avatar kameshsampath avatar lordofthejars avatar sebastienblanc avatar survivant avatar yanaga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kubernetes-tutorial's Issues

Slight error in the Dev Nation Kubernetes Tutorial - 2. Beginner - kubectl - Talk To The App

Hi Sebastien, hi Burr,

Your livestream today was incredible again :) .. I finally got the time to play with the kubernetes tutorial.

I found a little inconsistence in it.

In the Section “Talk to the App” on 2. Beginner / kubectl there is a slight error in the command querying the IP address.
The command "IP=$(minikube ip)” should be changed to "IP=$(minikube ip -p devnation)"

It took me quite a while to figure that out.

With regards
Wolfgang “DJ Madie” Kremser

error doing tutorial "certificate apiserver-kubelet-client not signed by CA certificate"

error execution phase certs/apiserver-kubelet-client: [certs] certificate apiserver-kubelet-client not signed by CA certificate ca: crypto/rsa: verification error
To see the stack trace of this error execute with --v=5 or higher

On Windows 11,

  1. ran Docker Desktop in Admin mode
  2. opened a windows terminal in administrator mode.
  3. ran wsl
  4. installed minikube for windows
  5. in wsl terminal
    minikube start --memory=2200mb --cpus=3 --kubernetes-version=v1.18.6 --vm-driver=docker -p devnation

I get the above error. Logs attached.

logs.txt

minikube starts only if I do

/mnt/c/kubernetes-tutorial$ minikube start driver=docker

Pizza Operator Crashlookbackoff

on Minikube
Caused by: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://10.96.0.1/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions. Message: Forbidden!Configured service account doesn't have access. Service account may have been revoked. customresourcedefinitions.apiextensions.k8s.io is forbidden: User "system:serviceaccount:pizzahat:quarkus-operator-example" cannot list resource "customresourcedefinitions" in API group "apiextensions.k8s.io" at the cluster scope.

This is also missing the copy feature:
https://www.screencast.com/t/vUnm5VfEnqw

Fix quarkus-demo version

The tag of the quarkus-demo image in the last section of "Elementary/Rolling Updates" is wrong

kubectl set image deployment/myboot myboot=quay.io/rhdevelopers/quarkus-demo:1.0.0

The correct tag is v1:

kubectl set image deployment/myboot myboot=quay.io/rhdevelopers/quarkus-demo:v1

Operators Tutorial - Pizza Operator GET request to Kubernetes API fails

Reproduction Steps

I followed these steps in the Operators tutorial:

kubectl create namespace pizzahat
kubectl config set-context --current --namespace=pizzahat

kubectl apply -f apps/pizzas/pizza-crd.yaml
kubectl apply -f apps/pizzas/pizza-deployment.yaml

Output of kubectl get pods -n pizzahat
image

Output of kubectl describe pod
image

To get more information, I tailed the pod.

Output of stern -n pizzahat pod/quarkus-operator-example-...
image

Investigation

I believe the URL is incorrect. More specifically, the authorization header should be included (or fixed somewhere in the Pizza Operator code), and v1beta1 should be v1.

Here are my steps for arriving at that conclusion:

  • Slightly modify apps/pizzas/pizza-deployment. I override the container's entrypoint so that I can get a shell:
    image

  • From inside the container, I curl the Kubernetes API.

    I executed the following commands:

    KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
    curl -sSk -H "Authorization: Bearer $KUBE_TOKEN" https://10.152.183.1:443/apis/apiextensions.k8s.io/v1/customresourcedefinitions

    This works.

URL to latest krew.tar.gz is no longer valid

The curl command in .devcontainer/Dockerfile that should download krew fails because the file is no longer available under that URL.
Building the docker image fails at that point - see below:

[..]
---> Running in 17ae19ccdb88
++ mktemp -d

  • cd /tmp/tmp.6jO9jNb4uK
    ++ uname
    ++ tr '[:upper:]' '[:lower:]'
  • OS=linux
    ++ uname -m
    ++ sed -e s/x86_64/amd64/ -e 's/(arm)(64)?.*/\1\2/' -e 's/aarch64$/arm64/'
  • ARCH=amd64
    + curl -fsSLO https://github.com/kubernetes-sigs/krew/releases/latest/download/krew.tar.gz
    curl: (22) The requested URL returned error: 404

    The command '/bin/sh -c ( set -x; cd "$(mktemp -d)" && OS="$(uname | tr '[:upper:]' '[:lower:]')" && ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/(arm)(64)?.*/\1\2/' -e 's/aarch64$/arm64/')" && curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/krew.tar.gz" && tar zxvf krew.tar.gz && KREW=./krew-"${OS}_${ARCH}" && "$KREW" install krew ) && kubectl krew install ctx && kubectl krew install ns' returned a non-zero code: 22

Full log file:
remoteContainers-2022-03-30T16-18-32.235Z.log

mkdir bin issue

https://redhat-developer-demos.github.io/kubernetes-tutorial/kubernetes-tutorial/installation.html#install-minikube

this instructs the reader to
cd $TUTORIAL_HOME
and then to
mkdir bin && cd bin

There is already a bin directory therefore mkdir fails. Also, it seems inappropriate to put the minikube and kubectl binaries in a bin folder IN the kubernetes-tutorial directory. I think it would be better if the bin for minikube/kubectl and other executables were a sibling/peer of the main tutorial directories.

Different background color on input/output code blocks

I believe it would be much easier to read the tutorial if we could have different background colors for input/output. Having something like this would probably allow us to automatically create the copy button on the section.

I google a lot to try to find how to add a css style to a section in Antora, but had no success. @lordofthejars, any tips? I can do it, but I just need some light on this subject.

Windows and Linux links swapped around

In https://raw.githubusercontent.com/redhat-developer-demos/rhd-tutorial-common/master/prerequisites-kubernetes.adoc
there are two pairs of links swapped around.

This:

| `VirtualBox`
| https://download.virtualbox.org/virtualbox/6.1.6/VirtualBox-6.1.6-137129-OSX.dmg[Download]
| https://download.virtualbox.org/virtualbox/6.1.6/VirtualBox-6.1.6-137129-Win.exe[Download]
| https://www.virtualbox.org/wiki/Linux_Downloads[Download]

| https://kubernetes.io/docs/tasks/tools/install-minikube[Minikube] {minikube-version}
| https://github.com/kubernetes/minikube/releases/download/{minikube-version}/minikube-darwin-amd64[Download]
| https://github.com/kubernetes/minikube/releases/download/{minikube-version}/minikube-windows-amd64.exe[Download]
| https://github.com/kubernetes/minikube/releases/download/{minikube-version}/minikube-linux-amd64[Download]

Should be:

| `VirtualBox`
| https://download.virtualbox.org/virtualbox/6.1.6/VirtualBox-6.1.6-137129-OSX.dmg[Download]
| https://www.virtualbox.org/wiki/Linux_Downloads[Download]
| https://download.virtualbox.org/virtualbox/6.1.6/VirtualBox-6.1.6-137129-Win.exe[Download]

| https://kubernetes.io/docs/tasks/tools/install-minikube[Minikube] {minikube-version}
| https://github.com/kubernetes/minikube/releases/download/{minikube-version}/minikube-darwin-amd64[Download]
| https://github.com/kubernetes/minikube/releases/download/{minikube-version}/minikube-linux-amd64[Download]
| https://github.com/kubernetes/minikube/releases/download/{minikube-version}/minikube-windows-amd64.exe[Download]

error in the service page about service name and service port.

in the page : https://github.com/redhat-scholars/kubernetes-tutorial/edit/master/documentation/modules/ROOT/pages/service.adoc
image

The name of the service should be : the-service (from the metadata) and not myapp

if I do : kubectl get svc -o wide I'll obtain this

vagrant@k8s-master ~ $ kubectl get svc -o wide
NAME                                                   TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                         AGE    SELECTOR
the-service                                            LoadBalancer   10.102.11.99     192.168.50.201   80:31203/TCP                    4s     app=quarkus-demo
vagrant@k8s-master ~ $

PS. Look at the port also, it's 80:(generated nodeport). in your example, it's 8080.
PS2. I'm running on-premise with MetalLB.

vagrant@k8s-master ~ $ kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.2", GitCommit:"f5743093fd1c663cb0cbc89748f730662345d44d", GitTreeState:"clean", BuildDate:"2020-09-16T13:41:02Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.2", GitCommit:"f5743093fd1c663cb0cbc89748f730662345d44d", GitTreeState:"clean", BuildDate:"2020-09-16T13:32:58Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
vagrant@k8s-master ~ $
vagrant@k8s-master ~ $ kubectl describe svc the-service
Name:                     the-service
Namespace:                default
Labels:                   <none>
Annotations:              <none>
Selector:                 app=quarkus-demo
Type:                     LoadBalancer
IP:                       10.102.11.99
LoadBalancer Ingress:     192.168.50.201
Port:                     <unset>  80/TCP
TargetPort:               8080/TCP
NodePort:                 <unset>  31203/TCP
Endpoints:                10.244.126.35:8080,10.244.194.122:8080,10.244.235.239:8080
Session Affinity:         None
External Traffic Policy:  Cluster
Events:
  Type    Reason        Age   From                Message
  ----    ------        ----  ----                -------
  Normal  IPAllocated   8m4s  metallb-controller  Assigned IP "192.168.50.201"
  Normal  nodeAssigned  8m4s  metallb-speaker     announcing from node "k8s-worker2"
vagrant@k8s-master ~ $

In working through homework for class one for resources I ran into a syntax error

Describe the pod

PODNAME=$(kubectl get pod  -l app=myboot -o name)
kubectl describe pod $PODNAME
$ kubectl describe pod $PODNAME
error: there is no need to specify a resource type as a separate argument when passing arguments in resource/name form (e.g. 'kubectl get resource/<resource_name>' instead of 'kubectl get resource resource/<resource_name>'
$ echo $PODNAME
pod/myboot-66d7d57687-qwnnf

$ kubectl describe $PODNAME
Name:         myboot-66d7d57687-qwnnf                                                                                  
Namespace:    myspace                                                                                                                                                                                                                         
Priority:     0
...

Using Ingress

With this project projectcontour.io incubating into CNCF, it will be nice for us to show the users about Ingress. This Ingress is based on envoy so the elements are just same as virtual service

@burrsutter @lordofthejars thoughts ??

Improving set env section

Improve the set env section with examples by adding examples to show variable interpolation in the command and args attributes of the deployment YAML. The args in command and args need to follow the variable substitution pattern like $(ENV_VAR_NAME).

I feel we need to call this out in the tutorial as developers will follow the natural instinct of using $ENV_VAR_NAME pattern.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.