Learning Resources for Operators – First Two Weeks Notes

To quote the Kubernetes website, “The Operator pattern captures how you can write code to automate a task beyond what Kubernetes itself provides.” The following is an compendium to use while Learning Operators.

The defacto SDK to use is the Operator SDK which provides HELM, Ansible and GO scaffolding to support your implementation of the Operator pattern.

The following are education classes on the OperatorSDK

When Running through the CO0201EN intermediate operators course, I did hit the case where I had to create a ClusterRole and ClusterRoleBinding for the ServiceAccount, here is a snippet that might helper others:

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
  namespace: memcached-operator-system
  name: service-reader-cr-mc
- apiGroups: ["cache.bastide.org"] # "" indicates the core API group
  resources: ["memcacheds"]
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
  namespace: memcached-operator-system
  name: ext-role-binding
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: service-reader-cr-mc
- kind: ServiceAccount
  namespace: memcached-operator-system
  name: memcached-operator-controller-manager

The reason for the above, I missed adding a kubebuilder declaration:


Thanks to https://stackoverflow.com/a/60334649/1873438

The following are articles worth reviewing:

The following are good Go resources:

  1. Go Code Comments – To write idiomatic Go, you should review the Code Review comments.
  2. Getting to Go: The Journey of Go’s Garbage Collector – The reference for Go and Garbage Collection in go
  3. An overview of memory management in Go – good overview of Go Memory Management
  4. Golang: Cost of using the heap – net 1M allocation seems to stay in the stack, outside it seems to be on the heap
  5. golangci-lint – The aggregated linters project is worthy of an installation and use. It’ll catch many issues and has a corresponding GitHub Action.
  6. Go in 3 Weeks A comprehensive training for Go. Companion to GitHub Repo
  7. Defensive Coding Guide: The Go Programming Language

The following are good OpenShift resources:

  1. Create OpenShift Plugins – You must have a CLI plug-in file that begins with oc- or kubectl-. You create a file and put it in /usr/local/bin/
  2. Details on running Code Ready Containers on Linux – The key hack I learned awas to ssh -i ~/.crc/machines/crc/id_ecdsa core@<any host in the /etc/hosts>
    1. I ran on VirtualBox Ubuntu 20.04 with Guest Additions Installed
    2. Virtual Box Settings for the Machine – 6 CPU, 18G
      1. System > Processor > Enable PAE/NX and Enable Nested VT-X/AMD-V (which is a must for it to work)
      1. Network > Change Adapter Type to virtio-net and Set Promiscuous Mode to Allow VMS
    3. Install openssh-server so you can login remotely
    4. It will not install without a windowing system, so I have the default windowing environment installed.
    5. Note, I still get a failure on startup complaining about a timeout. I waited about 15 minutes post this, and the command oc get nodes –context admin –cluster crc –kubeconfig .crc/cache/crc_libvirt_4.10.3_amd64/kubeconfig now works.
  3. CRC virsh cheatsheet – If you are running Code Ready Containers and need to debug, you can use the virsh cheatsheet.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.