bradleyd / devops_for_the_desperate

The companion code for the book DevOps for the Desperate
124 stars 69 forks source link

Chapter 7 - Please Help #25

Closed jasencarroll closed 1 year ago

jasencarroll commented 1 year ago

Output from Chapter 6 is flawless.

jasen@Renegade:devOps(main*)$ minikube start --driver=virtualbox
W0315 21:40:31.503000   12953 main.go:291] Unable to resolve the current Docker CLI context "default": context "default" does not exist
πŸ˜„  minikube v1.29.0 on Ubuntu 22.04
✨  Using the virtualbox driver based on user configuration
πŸ‘  Starting control plane node minikube in cluster minikube
πŸ”₯  Creating virtualbox VM (CPUs=2, Memory=6000MB, Disk=20000MB) ...
🐳  Preparing Kubernetes v1.26.1 on Docker 20.10.23 ...
    β–ͺ Generating certificates and keys ...
    β–ͺ Booting up control plane ...
    β–ͺ Configuring RBAC rules ...
πŸ”—  Configuring bridge CNI (Container Networking Interface) ...
    β–ͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
πŸ”Ž  Verifying Kubernetes components...
🌟  Enabled addons: default-storageclass, storage-provisioner
πŸ„  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
jasen@Renegade:devOps(main*)$ minikube docker-env
W0315 21:42:09.517386   13977 main.go:291] Unable to resolve the current Docker CLI context "default": context "default" does not exist
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.59.106:2376"
export DOCKER_CERT_PATH="/home/jasen/.minikube/certs"
export MINIKUBE_ACTIVE_DOCKERD="minikube"

# To point your shell to minikube's docker-daemon, run:
# eval $(minikube -p minikube docker-env)
jasen@Renegade:devOps(main*)$ ^C
jasen@Renegade:devOps(main*)$ eval $(minikube -p minikube docker-env)
W0315 21:42:35.665405   14080 main.go:291] Unable to resolve the current Docker CLI context "default": context "default" does not exist
jasen@Renegade:devOps(main*)$ docker --version
Docker version 23.0.1, build a5ee5b1
jasen@Renegade:devOps(main*)$ cd telnet-server/
jasen@Renegade:telnet-server(main*)$ docker build -t dftd/telnet-server:v1 .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon  30.72kB
Step 1/9 : FROM golang:alpine AS build-env
alpine: Pulling from library/golang
63b65145d645: Pull complete 
a2d21d5440eb: Pull complete 
935e6c44a52c: Pull complete 
94cc34f8dd06: Pull complete 
Digest: sha256:1db127655b32aa559e32ed3754ed2ea735204d967a433e4b605aed1dd44c5084
Status: Downloaded newer image for golang:alpine
 ---> 898000b2160b
Step 2/9 : ADD . /
 ---> 7cc76dc4198d
Step 3/9 : RUN cd / && go build -o telnet-server
 ---> Running in 72e12a126ee6
go: downloading github.com/prometheus/client_golang v1.6.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/golang/protobuf v1.4.0
go: downloading github.com/prometheus/common v0.9.1
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/prometheus/procfs v0.0.11
go: downloading google.golang.org/protobuf v1.21.0
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f
Removing intermediate container 72e12a126ee6
 ---> d8883e3d47b3
Step 4/9 : FROM alpine:latest as final
latest: Pulling from library/alpine
63b65145d645: Already exists 
Digest: sha256:ff6bdca1701f3a8a67e328815ff2346b0e4067d32ec36b7992c1fdc001dc8517
Status: Downloaded newer image for alpine:latest
 ---> b2aa39c304c2
Step 5/9 : WORKDIR /app
 ---> Running in 78924180d9c7
Removing intermediate container 78924180d9c7
 ---> 4827fa0a2a99
Step 6/9 : ENV TELNET_PORT 2323
 ---> Running in 19483d0b9c7f
Removing intermediate container 19483d0b9c7f
 ---> 207a91df947d
Step 7/9 : ENV METRIC_PORT 9000
 ---> Running in 86b0e6a6e037
Removing intermediate container 86b0e6a6e037
 ---> e4d674d473da
Step 8/9 : COPY --from=build-env /telnet-server /app/
 ---> 862c1462ab4a
Step 9/9 : ENTRYPOINT ["./telnet-server"]
 ---> Running in 22fffb844758
Removing intermediate container 22fffb844758
 ---> 2f32fb902fc6
Successfully built 2f32fb902fc6
Successfully tagged dftd/telnet-server:v1
jasen@Renegade:telnet-server(main*)$ docker image ls git 
REPOSITORY           TAG       IMAGE ID       CREATED          SIZE
dftd/telnet-server   v1        2f32fb902fc6   10 seconds ago   19MB
jasen@Renegade:telnet-server(main*)$ docker run -p 2323:2323 -d --name telnet-server dftd/telnet-server:v1
507cda205191e7f9afd9a68d650e6c5c9e54c5a6ae09abfdfa6782b179bf6607
jasen@Renegade:telnet-server(main*)$ docker container ls -f name=telnet-server
CONTAINER ID   IMAGE                   COMMAND             CREATED          STATUS         PORTS                    NAMES
507cda205191   dftd/telnet-server:v1   "./telnet-server"   10 seconds ago   Up 9 seconds   0.0.0.0:2323->2323/tcp   telnet-server
jasen@Renegade:telnet-server(main*)$ minikube ip
192.168.59.106
jasen@Renegade:telnet-server(main*)$ telnet 192.168.59.106 2323
Trying 192.168.59.106...
Connected to 192.168.59.106.
Escape character is '^]'.

____________ ___________
|  _  \  ___|_   _|  _  \
| | | | |_    | | | | | |
| | | |  _|   | | | | | |
| |/ /| |     | | | |/ /
|___/ \_|     \_/ |___/

>d
Thu Mar 16 04:45:47 +0000 UTC 2023
>q
Good Bye!
Connection closed by foreign host.

Here is Chapter 7. I can't figure this one out.

jasen@Renegade:telnet-server(main*)$ minikube kubectl cluster-info
Kubernetes control plane is running at https://192.168.59.106:8443
CoreDNS is running at https://192.168.59.106:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- explain deployment.metadata.labels
KIND:     Deployment
VERSION:  apps/v1

FIELD:    labels <map[string]string>

DESCRIPTION:
     Map of string keys and values that can be used to organize and categorize
     (scope and select) objects. May match selectors of replication controllers
     and services. More info: http://kubernetes.io/docs/user-guide/labels
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- apply -f kubernetes/
deployment.apps/telnet-server configured
service/telnet-server unchanged
service/telnet-server-metrics unchanged
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get deployments.apps telnet-server
NAME            READY   UP-TO-DATE   AVAILABLE   AGE
telnet-server   0/2     1            0           9m26s
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get pods -l app=telnet-server
NAME                             READY   STATUS             RESTARTS   AGE
telnet-server-5fd648cdd9-dwdkw   0/1     ImagePullBackOff   0          9m39s
telnet-server-5fd648cdd9-md9lv   0/1     ImagePullBackOff   0          9m39s
telnet-server-68f9f68c45-8d9s8   0/1     ErrImagePull       0          32s
jasen@Renegade:telnet-server(main*)$ minikube kubectl --help
Run the Kubernetes client, download it if necessary. Remember -- after kubectl!

This will run the Kubernetes client (kubectl) with the same version as the cluster

Normally it will download a binary matching the host operating system and architecture,
but optionally you can also run it directly on the control plane over the ssh connection.
This can be useful if you cannot run kubectl locally for some reason, like unsupported
host. Please be aware that when using --ssh all paths will apply to the remote machine.

Examples:
minikube kubectl -- --help
minikube kubectl -- get pods --namespace kube-system

Options:
    --ssh=false:
        Use SSH for running kubernetes client on the node

Usage:
  minikube kubectl [flags] [options]

Use "minikube options" for a list of global command-line options (applies to all commands).
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- --help
kubectl controls the Kubernetes cluster manager.

 Find more information at: https://kubernetes.io/docs/reference/kubectl/

Basic Commands (Beginner):
  create          Create a resource from a file or from stdin
  expose          Take a replication controller, service, deployment or pod and expose it as a new Kubernetes service
  run             Run a particular image on the cluster
  set             Set specific features on objects

Basic Commands (Intermediate):
  explain         Get documentation for a resource
  get             Display one or many resources
  edit            Edit a resource on the server
  delete          Delete resources by file names, stdin, resources and names, or by resources and label selector

Deploy Commands:
  rollout         Manage the rollout of a resource
  scale           Set a new size for a deployment, replica set, or replication controller
  autoscale       Auto-scale a deployment, replica set, stateful set, or replication controller

Cluster Management Commands:
  certificate     Modify certificate resources.
  cluster-info    Display cluster information
  top             Display resource (CPU/memory) usage
  cordon          Mark node as unschedulable
  uncordon        Mark node as schedulable
  drain           Drain node in preparation for maintenance
  taint           Update the taints on one or more nodes

Troubleshooting and Debugging Commands:
  describe        Show details of a specific resource or group of resources
  logs            Print the logs for a container in a pod
  attach          Attach to a running container
  exec            Execute a command in a container
  port-forward    Forward one or more local ports to a pod
  proxy           Run a proxy to the Kubernetes API server
  cp              Copy files and directories to and from containers
  auth            Inspect authorization
  debug           Create debugging sessions for troubleshooting workloads and nodes
  events          List events

Advanced Commands:
  diff            Diff the live version against a would-be applied version
  apply           Apply a configuration to a resource by file name or stdin
  patch           Update fields of a resource
  replace         Replace a resource by file name or stdin
  wait            Experimental: Wait for a specific condition on one or many resources
  kustomize       Build a kustomization target from a directory or URL.

Settings Commands:
  label           Update the labels on a resource
  annotate        Update the annotations on a resource
  completion      Output shell completion code for the specified shell (bash, zsh, fish, or powershell)

Other Commands:
  alpha           Commands for features in alpha
  api-resources   Print the supported API resources on the server
  api-versions    Print the supported API versions on the server, in the form of "group/version"
  config          Modify kubeconfig files
  plugin          Provides utilities for interacting with plugins
  version         Print the client and server version information

Usage:
  kubectl [flags] [options]

Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- delete
error: You must provide one or more resources by argument or filename.
Example resource specifications include:
   '-f rsrc.yaml'
   '--filename=rsrc.json'
   '<resource> <name>'
   '<resource>'
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- delete telnet/*
error: the server doesn't have a resource type "telnet"
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- delete telnet
error: the server doesn't have a resource type "telnet"
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get pods -l app=telnet-server
NAME                             READY   STATUS             RESTARTS   AGE
telnet-server-5fd648cdd9-dwdkw   0/1     ImagePullBackOff   0          14m
telnet-server-5fd648cdd9-md9lv   0/1     ImagePullBackOff   0          14m
telnet-server-68f9f68c45-8d9s8   0/1     ImagePullBackOff   0          5m12s
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- delete pod
error: resource(s) were provided, but no name was specified
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- delete pod telnet-server-5fd648cdd9-dwdkw
pod "telnet-server-5fd648cdd9-dwdkw" deleted
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- delete pod telnet-server-5fd648cdd9-md9lv
pod "telnet-server-5fd648cdd9-md9lv" deleted
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- delete pod telnet-server--68f9f68c45-8d9s8
Error from server (NotFound): pods "telnet-server--68f9f68c45-8d9s8" not found
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- delete pod telnet-server-68f9f68c45-8d9s8
pod "telnet-server-68f9f68c45-8d9s8" deleted
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get pods -l app=telnet-server
NAME                             READY   STATUS         RESTARTS   AGE
telnet-server-5fd648cdd9-6sh5r   0/1     ErrImagePull   0          30s
telnet-server-5fd648cdd9-9dtxf   0/1     ErrImagePull   0          45s
telnet-server-68f9f68c45-gpbpn   0/1     ErrImagePull   0          9s
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get endpoints -l app=telnet-server
NAME                    ENDPOINTS   AGE
telnet-server                       16m
telnet-server-metrics               16m
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get pods -l app=telnet-server
NAME                             READY   STATUS             RESTARTS   AGE
telnet-server-5fd648cdd9-6sh5r   0/1     ImagePullBackOff   0          5m41s
telnet-server-5fd648cdd9-9dtxf   0/1     ImagePullBackOff   0          5m56s
telnet-server-68f9f68c45-gpbpn   0/1     ImagePullBackOff   0          5m20s
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- delete pod telnet-server-5fd648cdd9-6sh5r
pod "telnet-server-5fd648cdd9-6sh5r" deleted
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- delete pod telnet-server-5fd648cdd9-9dtxf
pod "telnet-server-5fd648cdd9-9dtxf" deleted
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- delete pod telnet-server-68f9f68c45-gpbpn
pod "telnet-server-68f9f68c45-gpbpn" deleted
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get pods -l app=telnet-server
NAME                             READY   STATUS             RESTARTS   AGE
telnet-server-5fd648cdd9-2rljq   0/1     ErrImagePull       0          37s
telnet-server-5fd648cdd9-v8j7f   0/1     ImagePullBackOff   0          22s
telnet-server-68f9f68c45-ggwnl   0/1     ErrImagePull       0          6s
jasen@Renegade:telnet-server(main*)$ minikube ip
192.168.59.106
jasen@Renegade:telnet-server(main*)$ telnet 192.168.59.106 2323
Trying 192.168.59.106...
Connected to 192.168.59.106.
Escape character is '^]'.

____________ ___________
|  _  \  ___|_   _|  _  \
| | | | |_    | | | | | |
| | | |  _|   | | | | | |
| |/ /| |     | | | |/ /
|___/ \_|     \_/ |___/

>d
Thu Mar 16 05:13:19 +0000 UTC 2023
>q
Good Bye!
Connection closed by foreign host.
jasen@Renegade:telnet-server(main*)$ docker stats --no-stream telnet-server
CONTAINER ID   NAME            CPU %     MEM USAGE / LIMIT     MEM %     NET I/O          BLOCK I/O   PIDS
507cda205191   telnet-server   0.00%     1.336MiB / 5.651GiB   0.02%     2.1kB / 2.22kB   0B / 0B     4
jasen@Renegade:telnet-server(main*)$ docker history dftd/telnet-server:v1
IMAGE          CREATED          CREATED BY                                      SIZE      COMMENT
2f32fb902fc6   29 minutes ago   /bin/sh -c #(nop)  ENTRYPOINT ["./telnet-ser…   0B        
862c1462ab4a   29 minutes ago   /bin/sh -c #(nop) COPY file:ddd6f4d196922fab…   12MB      
e4d674d473da   29 minutes ago   /bin/sh -c #(nop)  ENV METRIC_PORT=9000         0B        
207a91df947d   29 minutes ago   /bin/sh -c #(nop)  ENV TELNET_PORT=2323         0B        
4827fa0a2a99   29 minutes ago   /bin/sh -c #(nop) WORKDIR /app                  0B        
b2aa39c304c2   4 weeks ago      /bin/sh -c #(nop)  CMD ["/bin/sh"]              0B        
<missing>      4 weeks ago      /bin/sh -c #(nop) ADD file:40887ab7c06977737…   7.05MB    
jasen@Renegade:telnet-server(main*)$ docker inspect telnet-server
[
    {
        "Id": "507cda205191e7f9afd9a68d650e6c5c9e54c5a6ae09abfdfa6782b179bf6607",
        "Created": "2023-03-16T04:45:00.726405304Z",
        "Path": "./telnet-server",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 6699,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2023-03-16T04:45:01.027052925Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:2f32fb902fc64b957bc6916f8ca2e19f4b0c319a546f7d4c9457efa5ea62b1f2",
        "ResolvConfPath": "/var/lib/docker/containers/507cda205191e7f9afd9a68d650e6c5c9e54c5a6ae09abfdfa6782b179bf6607/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/507cda205191e7f9afd9a68d650e6c5c9e54c5a6ae09abfdfa6782b179bf6607/hostname",
        "HostsPath": "/var/lib/docker/containers/507cda205191e7f9afd9a68d650e6c5c9e54c5a6ae09abfdfa6782b179bf6607/hosts",
        "LogPath": "/var/lib/docker/containers/507cda205191e7f9afd9a68d650e6c5c9e54c5a6ae09abfdfa6782b179bf6607/507cda205191e7f9afd9a68d650e6c5c9e54c5a6ae09abfdfa6782b179bf6607-json.log",
        "Name": "/telnet-server",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {
                    "max-size": "100m"
                }
            },
            "NetworkMode": "default",
            "PortBindings": {
                "2323/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "2323"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "CgroupnsMode": "host",
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "private",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                43,
                271
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": [],
            "BlkioDeviceReadBps": [],
            "BlkioDeviceWriteBps": [],
            "BlkioDeviceReadIOps": [],
            "BlkioDeviceWriteIOps": [],
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": [
                {
                    "Name": "nofile",
                    "Hard": 1048576,
                    "Soft": 1048576
                }
            ],
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/c5083ad4993ea3d63f2c87a787393e01840fdd58928a49b1f9d5ea3c3012bc03-init/diff:/var/lib/docker/overlay2/b0c1e128111a91a7513c54a5028d3836e73e048cc3f90891927bc7920fa52979/diff:/var/lib/docker/overlay2/ed270f9c8a361ac5a64e873fc876a3225feb79d2782c55fa619cba64340b5d19/diff:/var/lib/docker/overlay2/79c806a82bff6f718c460a9d54c84772ed72aae465144bf11bfa92dea88fe474/diff",
                "MergedDir": "/var/lib/docker/overlay2/c5083ad4993ea3d63f2c87a787393e01840fdd58928a49b1f9d5ea3c3012bc03/merged",
                "UpperDir": "/var/lib/docker/overlay2/c5083ad4993ea3d63f2c87a787393e01840fdd58928a49b1f9d5ea3c3012bc03/diff",
                "WorkDir": "/var/lib/docker/overlay2/c5083ad4993ea3d63f2c87a787393e01840fdd58928a49b1f9d5ea3c3012bc03/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [],
        "Config": {
            "Hostname": "507cda205191",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "2323/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "TELNET_PORT=2323",
                "METRIC_PORT=9000"
            ],
            "Cmd": null,
            "Image": "dftd/telnet-server:v1",
            "Volumes": null,
            "WorkingDir": "/app",
            "Entrypoint": [
                "./telnet-server"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "426086e9cf416dce47acdf5ae7fff4e2b876612d4db3f07106970899425804eb",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "2323/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "2323"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/426086e9cf41",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "82894c96620fe47e81108a7707c99e7d7f54620c884d584746d10333e10d3938",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "cef4436cf314ffe2176c7a8600489298cc6ed7fecfe36dad534e9d779af26045",
                    "EndpointID": "82894c96620fe47e81108a7707c99e7d7f54620c884d584746d10333e10d3938",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02",
                    "DriverOpts": null
                }
            }
        }
    }
]
jasen@Renegade:telnet-server(main*)$ docker exec -it telnet-server /bin/sh
/app # exit
jasen@Renegade:telnet-server(main*)$ docker exec telnet-server env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=507cda205191
TELNET_PORT=2323
METRIC_PORT=9000
HOME=/root
jasen@Renegade:telnet-server(main*)$ docker exec telnet-server env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=507cda205191
TELNET_PORT=2323
METRIC_PORT=9000
HOME=/root
jasen@Renegade:telnet-server(main*)$ docker container ls -f name=telnet-server
CONTAINER ID   IMAGE                       COMMAND             CREATED          STATUS          PORTS                    NAMES
bacdab32d850   registry.k8s.io/pause:3.6   "/pause"            5 minutes ago    Up 5 minutes                             k8s_POD_telnet-server-68f9f68c45-ggwnl_default_5b09cc3c-ecdf-483e-adfd-641955b5c0f2_0
8bc0526561f3   registry.k8s.io/pause:3.6   "/pause"            5 minutes ago    Up 5 minutes                             k8s_POD_telnet-server-5fd648cdd9-v8j7f_default_e63fe101-69fa-40cd-ab4f-77b211e26eff_0
4836c1e5fb75   registry.k8s.io/pause:3.6   "/pause"            6 minutes ago    Up 5 minutes                             k8s_POD_telnet-server-5fd648cdd9-2rljq_default_be99308c-ab12-4f57-850e-29afc56f6672_0
507cda205191   dftd/telnet-server:v1       "./telnet-server"   31 minutes ago   Up 31 minutes   0.0.0.0:2323->2323/tcp   telnet-server
jasen@Renegade:telnet-server(main*)$ docker image ls
REPOSITORY                                TAG       IMAGE ID       CREATED          SIZE
dftd/telnet-server                        v1        2f32fb902fc6   32 minutes ago   19MB
<none>                                    <none>    d8883e3d47b3   32 minutes ago   380MB
golang                                    alpine    898000b2160b   8 days ago       254MB
alpine                                    latest    b2aa39c304c2   4 weeks ago      7.05MB
registry.k8s.io/kube-apiserver            v1.26.1   deb04688c4a3   8 weeks ago      134MB
registry.k8s.io/kube-scheduler            v1.26.1   655493523f60   8 weeks ago      56.3MB
registry.k8s.io/kube-controller-manager   v1.26.1   e9c08e11b07f   8 weeks ago      124MB
registry.k8s.io/kube-proxy                v1.26.1   46a6bb3c77ce   8 weeks ago      65.6MB
registry.k8s.io/etcd                      3.5.6-0   fce326961ae2   3 months ago     299MB
registry.k8s.io/pause                     3.9       e6f181688397   5 months ago     744kB
registry.k8s.io/coredns/coredns           v1.9.3    5185b96f0bec   9 months ago     48.8MB
registry.k8s.io/pause                     3.6       6270bb605e12   18 months ago    683kB
gcr.io/k8s-minikube/storage-provisioner   v5        6e38f40d628d   23 months ago    31.5MB
jasen@Renegade:telnet-server(main*)$ spec.selector
spec.selector: command not found
jasen@Renegade:telnet-server(main*)$ spec.selector
spec.selector: command not found
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get services -l app=telnet-server
NAME                    TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
telnet-server           LoadBalancer   10.104.37.35   <pending>     2323:31340/TCP   30m
telnet-server-metrics   ClusterIP      10.100.0.62    <none>        9000/TCP         30m
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get pods -l app=telnet-server
NAME                             READY   STATUS             RESTARTS   AGE
telnet-server-5fd648cdd9-2rljq   0/1     ImagePullBackOff   0          9m32s
telnet-server-5fd648cdd9-v8j7f   0/1     ImagePullBackOff   0          9m17s
telnet-server-68f9f68c45-ggwnl   0/1     ImagePullBackOff   0          9m1s
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get deployments.apps telnet-server
NAME            READY   UP-TO-DATE   AVAILABLE   AGE
telnet-server   0/2     1            0           31m
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- apply -f kubernetes/
deployment.apps/telnet-server configured
service/telnet-server unchanged
service/telnet-server-metrics unchanged
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get deployments.apps telnet-server
NAME            READY   UP-TO-DATE   AVAILABLE   AGE
telnet-server   0/2     1            0           32m
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get deployments.apps telnet-server
NAME            READY   UP-TO-DATE   AVAILABLE   AGE
telnet-server   0/2     1            0           32m
jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get pods -l app=telnet-server
NAME                             READY   STATUS             RESTARTS   AGE
telnet-server-5fd648cdd9-2rljq   0/1     ImagePullBackOff   0          10m
telnet-server-5fd648cdd9-v8j7f   0/1     ImagePullBackOff   0          10m
telnet-server-68f9f68c45-ggwnl   0/1     ImagePullBackOff   0          9m58s
jasen@Renegade:telnet-server(main*)$ git add .
jasen@Renegade:telnet-server(main*)$ git commit -m 'everything checks out but ImagePullBackOff again'
[main b043e9e] everything checks out but ImagePullBackOff again
 1 file changed, 3 insertions(+), 4 deletions(-)
jasen@Renegade:telnet-server(main*)$ git push origin main
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 16 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 517 bytes | 517.00 KiB/s, done.
Total 5 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/jasencarroll/DevOps-Desperate.git
   2664231..b043e9e  main -> main
jasen@Renegade:telnet-server(main*)$ docker image ls git
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
jasen@Renegade:telnet-server(main*)$ telnet 192.168.59.106 2323
Trying 192.168.59.106...
Connected to 192.168.59.106.
Escape character is '^]'.

____________ ___________
|  _  \  ___|_   _|  _  \
| | | | |_    | | | | | |
| | | |  _|   | | | | | |
| |/ /| |     | | | |/ /
|___/ \_|     \_/ |___/

>d
Thu Mar 16 05:25:48 +0000 UTC 2023
>q
Good Bye!
Connection closed by foreign host.
jasen@Renegade:telnet-server(main*)$ docker build -t dftd/telnet-server:v1 .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon  30.72kB
Step 1/9 : FROM golang:alpine AS build-env
 ---> 898000b2160b
Step 2/9 : ADD . /
 ---> Using cache
 ---> 7cc76dc4198d
Step 3/9 : RUN cd / && go build -o telnet-server
 ---> Using cache
 ---> d8883e3d47b3
Step 4/9 : FROM alpine:latest as final
 ---> b2aa39c304c2
Step 5/9 : WORKDIR /app
 ---> Using cache
 ---> 4827fa0a2a99
Step 6/9 : ENV TELNET_PORT 2323
 ---> Using cache
 ---> 207a91df947d
Step 7/9 : ENV METRIC_PORT 9000
 ---> Using cache
 ---> e4d674d473da
Step 8/9 : COPY --from=build-env /telnet-server /app/
 ---> Using cache
 ---> 862c1462ab4a
Step 9/9 : ENTRYPOINT ["./telnet-server"]
 ---> Using cache
 ---> 2f32fb902fc6
Successfully built 2f32fb902fc6
Successfully tagged dftd/telnet-server:v1
jasen@Renegade:telnet-server(main*)$ docker image ls git
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
jasen@Renegade:telnet-server(main*)$ docker run -p 2323:2323 -d --name telnet-server dftd/telnet-server:v1
docker: Error response from daemon: Conflict. The container name "/telnet-server" is already in use by container "507cda205191e7f9afd9a68d650e6c5c9e54c5a6ae09abfdfa6782b179bf6607". You have to remove (or rename) that container to be able to reuse that name.
See 'docker run --help'.
jasen@Renegade:telnet-server(main*)$ docker container ls -f name=telnet-server
CONTAINER ID   IMAGE                       COMMAND             CREATED          STATUS          PORTS                    NAMES
bacdab32d850   registry.k8s.io/pause:3.6   "/pause"            16 minutes ago   Up 16 minutes                            k8s_POD_telnet-server-68f9f68c45-ggwnl_default_5b09cc3c-ecdf-483e-adfd-641955b5c0f2_0
8bc0526561f3   registry.k8s.io/pause:3.6   "/pause"            17 minutes ago   Up 17 minutes                            k8s_POD_telnet-server-5fd648cdd9-v8j7f_default_e63fe101-69fa-40cd-ab4f-77b211e26eff_0
4836c1e5fb75   registry.k8s.io/pause:3.6   "/pause"            17 minutes ago   Up 17 minutes                            k8s_POD_telnet-server-5fd648cdd9-2rljq_default_be99308c-ab12-4f57-850e-29afc56f6672_0
507cda205191   dftd/telnet-server:v1       "./telnet-server"   42 minutes ago   Up 42 minutes   0.0.0.0:2323->2323/tcp   telnet-server
jasen@Renegade:telnet-server(main*)$ ^C
jasen@Renegade:telnet-server(main*)$ 

This is what happened to my dockerd service. I don't know when or how this stopped running and how the docker was able to keep going?

Also I'm really confused why we installed docker locally and your statement was "if docker connected with minikube correctly run docker version" like, my docker version was already working from the bin installs?


asen@Renegade:Downloads$ sudo dockerd &
[1] 10799
jasen@Renegade:Downloads$ INFO[2023-03-15T21:27:50.882337779-07:00] Starting up                                  
INFO[2023-03-15T21:27:50.882741526-07:00] detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf 
INFO[2023-03-15T21:27:50.901889828-07:00] [core] [Channel #1] Channel created           module=grpc
INFO[2023-03-15T21:27:50.901917305-07:00] [core] [Channel #1] original dial target is: "unix:///run/containerd/containerd.sock"  module=grpc
INFO[2023-03-15T21:27:50.901937881-07:00] [core] [Channel #1] parsed dial target is: {Scheme:unix Authority: Endpoint:run/containerd/containerd.sock URL:{Scheme:unix Opaque: User: Host: Path:/run/containerd/containerd.sock RawPath: OmitHost:false ForceQuery:false RawQuery: Fragment: RawFragment:}}  module=grpc
INFO[2023-03-15T21:27:50.901944378-07:00] [core] [Channel #1] Channel authority set to "localhost"  module=grpc
INFO[2023-03-15T21:27:50.902030817-07:00] [core] [Channel #1] Resolver state updated: {
  "Addresses": [
    {
      "Addr": "/run/containerd/containerd.sock",
      "ServerName": "",
      "Attributes": {},
      "BalancerAttributes": null,
      "Type": 0,
      "Metadata": null
    }
  ],
  "ServiceConfig": null,
  "Attributes": null
} (resolver returned new addresses)  module=grpc
INFO[2023-03-15T21:27:50.902073844-07:00] [core] [Channel #1] Channel switches to new LB policy "pick_first"  module=grpc
INFO[2023-03-15T21:27:50.902122492-07:00] [core] [Channel #1 SubChannel #2] Subchannel created  module=grpc
INFO[2023-03-15T21:27:50.902153644-07:00] [core] [Channel #1 SubChannel #2] Subchannel Connectivity change to CONNECTING  module=grpc
INFO[2023-03-15T21:27:50.902178492-07:00] [core] [Channel #1 SubChannel #2] Subchannel picks a new address "/run/containerd/containerd.sock" to connect  module=grpc
INFO[2023-03-15T21:27:50.902327688-07:00] [core] [Channel #1] Channel Connectivity change to CONNECTING  module=grpc
INFO[2023-03-15T21:27:50.902442348-07:00] [core] [Channel #1 SubChannel #2] Subchannel Connectivity change to READY  module=grpc
INFO[2023-03-15T21:27:50.902461357-07:00] [core] [Channel #1] Channel Connectivity change to READY  module=grpc
INFO[2023-03-15T21:27:50.903331088-07:00] [core] [Channel #4] Channel created           module=grpc
INFO[2023-03-15T21:27:50.903342012-07:00] [core] [Channel #4] original dial target is: "unix:///run/containerd/containerd.sock"  module=grpc
INFO[2023-03-15T21:27:50.903355224-07:00] [core] [Channel #4] parsed dial target is: {Scheme:unix Authority: Endpoint:run/containerd/containerd.sock URL:{Scheme:unix Opaque: User: Host: Path:/run/containerd/containerd.sock RawPath: OmitHost:false ForceQuery:false RawQuery: Fragment: RawFragment:}}  module=grpc
INFO[2023-03-15T21:27:50.903361231-07:00] [core] [Channel #4] Channel authority set to "localhost"  module=grpc
INFO[2023-03-15T21:27:50.903383905-07:00] [core] [Channel #4] Resolver state updated: {
  "Addresses": [
    {
      "Addr": "/run/containerd/containerd.sock",
      "ServerName": "",
      "Attributes": {},
      "BalancerAttributes": null,
      "Type": 0,
      "Metadata": null
    }
  ],
  "ServiceConfig": null,
  "Attributes": null
} (resolver returned new addresses)  module=grpc
INFO[2023-03-15T21:27:50.903400961-07:00] [core] [Channel #4] Channel switches to new LB policy "pick_first"  module=grpc
INFO[2023-03-15T21:27:50.903417400-07:00] [core] [Channel #4 SubChannel #5] Subchannel created  module=grpc
INFO[2023-03-15T21:27:50.903431304-07:00] [core] [Channel #4 SubChannel #5] Subchannel Connectivity change to CONNECTING  module=grpc
INFO[2023-03-15T21:27:50.903444341-07:00] [core] [Channel #4 SubChannel #5] Subchannel picks a new address "/run/containerd/containerd.sock" to connect  module=grpc
INFO[2023-03-15T21:27:50.903462331-07:00] [core] [Channel #4] Channel Connectivity change to CONNECTING  module=grpc
INFO[2023-03-15T21:27:50.903711175-07:00] [core] [Channel #4 SubChannel #5] Subchannel Connectivity change to READY  module=grpc
INFO[2023-03-15T21:27:50.903750262-07:00] [core] [Channel #4] Channel Connectivity change to READY  module=grpc
INFO[2023-03-15T21:27:50.950272470-07:00] [graphdriver] using prior storage driver: overlay2 
INFO[2023-03-15T21:27:50.971548829-07:00] Loading containers: start.                   
INFO[2023-03-15T21:27:51.164785286-07:00] Removing stale sandbox 23bc190e6b5d8bcac39e8e7acc1bca291d02561a81f3f4d0308c9e520751fe2a (c8ffaf269440249f2faca383c5dd0968d489fbf096d606d78a07a1a4106cf090) 
WARN[2023-03-15T21:27:51.298283485-07:00] Error (Unable to complete atomic operation, key modified) deleting object [endpoint 6d007e64896ddfd29b62c905364f17991e5798ab1db61c4b259fec97170f9219 a2f1d6eb62585756ae7f859622fe133e277bcdd591daf69db581c6c618e64a91], retrying.... 
INFO[2023-03-15T21:27:51.650567675-07:00] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address 
INFO[2023-03-15T21:27:51.684041422-07:00] Loading containers: done.                    
INFO[2023-03-15T21:27:51.692066980-07:00] Docker daemon                                 commit=bc3805a graphdriver=overlay2 version=23.0.1
INFO[2023-03-15T21:27:51.692320181-07:00] Daemon has completed initialization          
INFO[2023-03-15T21:27:51.714690356-07:00] [core] [Server #7] Server created             module=grpc
INFO[2023-03-15T21:27:51.717524264-07:00] API listen on /var/run/docker.sock           
jasen@Renegade:Downloads$ sudo dockerd &
[2] 21226

[2]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &
[3] 21292

[3]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &
[4] 21319

[4]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &
[5] 21342

[5]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &
[6] 21352

[6]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &
[7] 21362

[7]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &
[8] 21373

[8]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &
[9] 21383

[9]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &
[10] 21393

[10]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &
[11] 21403

[11]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &
[12] 21413

[12]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &
[13] 21423

[13]+  Stopped                 sudo dockerd
jasencarroll commented 1 year ago

I know I posted a lot and I just wanted to say I really do appreciate this book and it's content, I'm learning a ton.

bradleyd commented 1 year ago

Hey @jasencarroll, I am trying to understand what you have going on here. There is a lot of output and you changing stuff. I think you have two versions of docker running? There should only be one version of docker and that is inside minikube. Make sure you are setting the minikube docker env in the shell you are working in. Also, you should only installed the docker client locally.

I hope that helps and gets digging around more.

jasencarroll commented 1 year ago

@bradleyd, thanks for the response; I get that it was a lot to read through. When I only had one docker version, which was inside of minikube, I would consistently see this output.

Unable to resolve the current Docker CLI context "default": context "default" does not exist.

Have you run into that before? Does it matter to me?


At some point, I installed Docker Desktop and progressed through this chapter though that couldn't be replicated on any other machines, and I don't count that as success.


From the example above, I could not get the Status to change. Based on your message, I should have the Docker binaries installed locally; this would be in the appropriate /bin/ in my path since I'm in Ubuntu. I should not install the Docker binaries inside of minikube. minikube should be fine as is, and once the binaries are in my bin, I can tell minikube to grab that env and activate.

jasen@Renegade:telnet-server(main*)$ minikube kubectl -- get pods -l app=telnet-server
NAME                             READY   STATUS             RESTARTS   AGE
telnet-server-5fd648cdd9-2rljq   0/1     ImagePullBackOff   0          10m
telnet-server-5fd648cdd9-v8j7f   0/1     ImagePullBackOff   0          10m
telnet-server-68f9f68c45-ggwnl   0/1     ImagePullBackOff   0          9m58s

Please confirm/deny if my statements are factual so far.


By this point, I realized docked had crashed. I don't understand why, and trying to rerun it resulted in this weird stuff:

jasen@Renegade:Downloads$ sudo dockerd &
[2] 21226

[2]+  Stopped                 sudo dockerd
jasen@Renegade:Downloads$ sudo dockerd &

I was running sudo dockerd & to suppress the Unable to resolve the current Docker CLI context "default": context "default" does not exist but maybe that's where I'm confused and doing the wrong thing. Should minikube be running sudo docker & as part of its automation and I should be working about this?

Any insight would be greatly appreciated before I attempt again. :)

bradleyd commented 1 year ago

Sorry nothings coming to mind; I have never seen that error following the chapters. You have minikube, virtualbox installed? Did you deviate from the book at all? I can try doing that on Ubuntu and see what happens.

jasencarroll commented 1 year ago

@bradleyd, thanks for reviewing and letting me know. Don't do anything yet, I'd hate to waste your time. I will advise when I get back to this with a fresh environment. I suppose I could try this second half of the book on Windows too since Vagrant was the limitation earlier.

bradleyd commented 1 year ago

Any updates before I close this ticket?